Question

Is there a way of having liquibase call a custom Java class/plugin and giving that class access to the underlying connection to make data changes. I had a look but it only

So of our update steps require extensive data manipulation which is far far easier to do and debug in code than using SQL. So I would want to write tasks that can extract, transform and save data. Is that possible within the liquibase framework?

Was it helpful?

Solution

If you are using a subclass of Change using the extension framework (liquibase.org/extensions) the generateStatements() method is passed the Database object the change is being executed against. Calling

((JdbcConnection) Database.getConnection()).getUnderlyingConnection() 

will return the java.sql.Connection used.

If you are using the CustomTaskChange interface, the execute() method that is executed is passed the same Database object you can get the connection from.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top