Snapshot representation does not include data even if "snapshot data" is enabled
See original GitHub issueLiquibase Version: 4.6.1 Liquibase Integration & Version:Maven Database Vendor & Version: POSTGRESQL Operating System Type & Version: Windows
Description: we are planning to use Liquibase for test data snapshot and after updating the test data using microservice then roll back with snapshot version. This was whole idea behind doing the POC. I have configured a POSTGRESQL db and using pgadmin as a front end.
Steps To Reproduce
Using the command prompt i have entered “liquibase --snapshotFormat=json --outputFile=test_snapshot.json --url=jdbc:postgresql://localhost:5432/postgres --username=postgres --password=test --should-snapshot-data=true snapshot --logLevel=INFO”
C:\Automation Assessmen- CF\liquibase\dbcon\dbcon>liquibase --snapshotFormat=json --outputFile=test_snapshot.json --url=jdbc:postgresql://localhost:5432/postgres --username=postgres --password=**** --should-snapshot-data=true snapshot --logLevel=debug
Actual Behavior test_snapshot json file is generated with the following data:
{
"snapshot": {
"created": "2021-12-02T16:18:01.394",
"database": {
"productVersion": "13.3",
"shortName": "postgresql",
"majorVersion": "13",
"minorVersion": "3",
"user": "postgres",
"productName": "PostgreSQL",
"url": "jdbc:postgresql://localhost:5432/postgres"
},
"objects": {
"liquibase.structure.core.Catalog": [
{
"catalog": {
"default": true,
"name": "postgres",
"snapshotId": "908d100"
}
}]
,
"liquibase.structure.core.Column": [
{
"column": {
"defaultValue": true,
"name": "active",
"nullable": true,
"order": "3!{java.lang.Integer}",
"relation": "liquibase.structure.core.Table#908d102",
"snapshotId": "908d106",
"type": {
"characterOctetLength": "1!{java.lang.Integer}",
"columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
"dataTypeId": "-7!{java.lang.Integer}",
"radix": "10!{java.lang.Integer}",
"typeName": "bool"
}
}
},
{
"column": {
"name": "age",
"nullable": true,
"order": "4!{java.lang.Integer}",
"relation": "liquibase.structure.core.Table#908d102",
"snapshotId": "908d107",
"type": {
"characterOctetLength": "19!{java.lang.Integer}",
"columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
"dataTypeId": "-5!{java.lang.Integer}",
"radix": "10!{java.lang.Integer}",
"typeName": "int8"
}
}
},
{
"column": {
"name": "id",
"nullable": false,
"order": "1!{java.lang.Integer}",
"relation": "liquibase.structure.core.Table#908d102",
"snapshotId": "908d104",
"type": {
"characterOctetLength": "10!{java.lang.Integer}",
"columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
"dataTypeId": "4!{java.lang.Integer}",
"radix": "10!{java.lang.Integer}",
"typeName": "int4"
}
}
},
{
"column": {
"name": "name",
"nullable": false,
"order": "2!{java.lang.Integer}",
"relation": "liquibase.structure.core.Table#908d102",
"snapshotId": "908d105",
"type": {
"characterOctetLength": "50!{java.lang.Integer}",
"columnSize": "50!{java.lang.Integer}",
"columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
"dataTypeId": "12!{java.lang.Integer}",
"radix": "10!{java.lang.Integer}",
"typeName": "varchar"
}
}
}]
,
"liquibase.structure.core.Index": [
{
"index": {
"columns": [
"liquibase.structure.core.Column#908d104"]
,
"name": "sampletable_pkey",
"snapshotId": "908d103",
"table": "liquibase.structure.core.Table#908d102",
"unique": true
}
}]
,
"liquibase.structure.core.PrimaryKey": [
{
"primaryKey": {
"backingIndex": "liquibase.structure.core.Index#908d103",
"columns": [
"liquibase.structure.core.Column#908d104"]
,
"name": "sampletable_pkey",
"snapshotId": "908d108",
"table": "liquibase.structure.core.Table#908d102"
}
}]
,
"liquibase.structure.core.Schema": [
{
"schema": {
"catalog": "liquibase.structure.core.Catalog#908d100",
"default": true,
"name": "public",
"snapshotId": "908d101"
}
}]
,
"liquibase.structure.core.Table": [
{
"table": {
"columns": [
"liquibase.structure.core.Column#908d104",
"liquibase.structure.core.Column#908d105",
"liquibase.structure.core.Column#908d106",
"liquibase.structure.core.Column#908d107"]
,
"default_tablespace": false,
"indexes": [
"liquibase.structure.core.Index#908d103"]
,
"name": "sampletable",
"primaryKey": "liquibase.structure.core.PrimaryKey#908d108",
"schema": "liquibase.structure.core.Schema#908d101",
"snapshotId": "908d102"
}
}]
},
"snapshotControl": {
"snapshotControl": {
"includedType": [
"liquibase.structure.core.Catalog",
"liquibase.structure.core.Column",
"liquibase.structure.core.ForeignKey",
"liquibase.structure.core.Index",
"liquibase.structure.core.PrimaryKey",
"liquibase.structure.core.Schema",
"liquibase.structure.core.Sequence",
"liquibase.structure.core.Table",
"liquibase.structure.core.UniqueConstraint",
"liquibase.structure.core.View"]
}
}
}
}
Expected/Desired Behavior
There are no reference to the test data that were present in the DB
Is it something expected? Back to my original requriement is it something possible using liquibase( data snapshot & then rolling back to previous state)??
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top GitHub Comments
Hi, @kathir43 ! We have a project at Liquibase that handles version of test data. You can get access to it here: https://github.com/liquibase/liquibase-data. This might be helpful. Please join me on our Discord to chat about it. I’m r2liquibase over there.
As far as whether this is something we can fix or not, the problem is going to be that the snapshot object structure is designed to be in-memory, but the data dump can easily be too large to fit in memory. That is part of why the queries for data is in the changeSet generation when we can stream to files vs. being part of the snapshot process.
Because of that, fixing this will be relatively complex.
(I updated the title and description a bit)