Hello
two questions:
1) I know that it is possible to load data from CSV files. But is it possible to export data to CSV ?
Something like this will generate insert change sets!
- liquibase.bat --defaultsFile=properties/liquibase.properties --changeLogFile=âoutput.xmlâ --diffTypes=âdataâ generateChangeLog
Also I didnât find option to specify list of tables to be exported.
2) Is there are way to have such change set which is executed every time when update is done ?
Thanks!
1: Yes, it is possible to export data to a CSV ( with Liquibase ).
liquibase generate-changelog --diffTypes=data --dataOutputDirectory=dataonly --changelog-file=loadDataOnly_changelog.xml
This command creates a loadData change log XML file in the current directory. It alos exports all the data into CSV files into the subdirectory dataonly.
I am using a Postgres Database. My liquibase.properties file specifies the schema so it only exports the tables in one schema of the database.
It exports ALL data. It is not performing a difference comparison.
2: âexecuted every time âŚâ
Liquibase does not provide a triggering mechanism ( that I know of ) to launch an update. Some databases provide triggers that can execute commands, so theoretically you could write a database trigger that fires on an update and the launches a script or run liquibase directly. Depending on your situation and your goals, I would recommend that you proceed with caution. Perhaps it would be better to schedule a daily / weekly ⌠job to perform the liquibase activities you desire.