How to dump data as SQL from the liquibase Java API?

Platform: Java 8, liquibase, derby, liquibase 3.5.3

Here's what I want to do
  1. Write Java code that creates a derby database using a liquibase schema (already in place)
  2. Write Java code to parse CSV data from a legacy system and populate the derby database using plain JDBC
  3. Export the data from the derby database as SQL in a form that can be used to populate a PostgreSQL database initialized by the same liquibase schema

Since I already have Liquibase available, is there a way I could accomplish step 3 using liquibase? 

Or would it be less effort to just do selects in JDBC and walk the resultsets to output them as SQL in print statements?


  • Steinar

So far I’ve done this (liquibase is a Liquibase object that already has been used to set up the schema)

            examples[i] = examples[i].customize(database);
I had hoped that when using a null catalogAndSchema I would just use the database I already had set up and populated with data…?