May 7, 2021

Easily Import Data into your Database

We recently saw a tweet looking for an easy way to import data into a database. Many Liquibase users may not know that Liquibase can easily help with this!

Liquibase does far more than CSV data loading. You can manage any database schema change just like app code change in source control. But databases don’t just have code! They have data, too. In some instances, you may want to load data into your database. For example, your application may hold insurance policies that are described in the database. Using the Liquibase loadData functionality can make sure those changes are applied correctly.

You can easily do this with the following XML. (JSON and YAML, are supported, too.)


     
       
      
    

Maybe you have data in the table that simply needs to be replaced with the CSV file data? To do that, use the delete functionality.

Remember to add runAlways=”true” to both of these changesets. That way, Liquibase will make sure the data is always up to date. Here’s a full example:

  
      



     
       
      
    

Load your data with Liquibase

Need help or have questions about loading data into your database with Liquibase? We’re happy to help. You can always try out our expert support through a Liquibase Pro trial or head over to get help on our community forum.

Share on: