should-snapshot-data parameter

The should-snapshot-data parameter is a Boolean that allows Liquibase to snapshot your database data. The default value is false.


You can use the should-snapshot-data parameter with the generateChangeLog command. If you specify shouldSnapshotData=true, the generateChangeLog command will include insert statements for the data in your database or <loadData> if the dataDir argument is set.

Note: The diffChangeLog command does not compare data and therefore does not generate the data-related changesets, even if you have shouldSnapshotData=true.

The Liquibase snapshot command captures the state of the database at a certain point in time and generates the snapshot of a database schema. Using the should-snapshot-data parameter, you can snapshot not only the database schema but also all database data for audits and reporting.

Setting the should-snapshot-data parameter

You can set the should-snapshot-data parameter in one of the following ways:

should-snapshot-data as a Java system property

You can set the should-snapshot-data parameter as a Java system property by using the JAVA_OPTS Environment Variable in your command line.

The syntax for Mac/Linux:


The syntax for Windows, which requires the set command:

set JAVA_OPTS=-Dliquibase.shouldSnapshotData=<true|false>

should-snapshot-data in the file

You can set the should-snapshot-data parameter by adding the following to your file:

liquibase.shouldSnapshotData: <true|false>

should-snapshot-data as a CLI global parameter

You can use should-snapshot-data as a global parameter in your command line with a Liquibase command, such as generateChangeLog

Note: Starting with Liquibase 4.4, the correct syntax for the generateChangeLog command is generate-changelog.

liquibase --should-snapshot-data=<true|false> generate-changelog

should-snapshot-data as an environment variable

If you use Liquibase Pro, you can set should-snapshot-data as an environment variable.

The syntax for Mac/Linux:


The syntax for Windows, which requires the set command:


Note: The commands shown above only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.