You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks data are dumped from tables in alphabetic orders therefore sometimes created dump cannot be imported.
CREATETABLEconsumer (
id STRING(36) NOT NULL,
merchant_id STRING(36) NOT NULL,
company_id STRING(36) NOT NULL,
external_id STRING(36) NOT NULL,
type STRING(10) NOT NULL,
status STRING(8),
created_at TIMESTAMPNOT NULL,
) PRIMARY KEY(id);
CREATETABLEaccount (
id STRING(36) NOT NULL,
merchant_id STRING(36) NOT NULL,
company_id STRING(36) NOT NULL,
type STRING(10) NOT NULL,
status STRING(8),
currency STRING(3) NOT NULL,
balance FLOAT64 DEFAULT (0.0),
available_amount FLOAT64 DEFAULT (0.0),
activated_amount FLOAT64 DEFAULT (0.0),
blocked_amount FLOAT64 DEFAULT (0.0),
created_at TIMESTAMPNOT NULL,
) PRIMARY KEY(id);
CREATETABLEaccount_owner (
consumer_id STRING(36) NOT NULL,
account_id STRING(36) NOT NULL,
FOREIGN KEY(consumer_id) REFERENCES consumer(id),
FOREIGN KEY(account_id) REFERENCES account(id),
) PRIMARY KEY(consumer_id, account_id);
INSERT INTO`account` (`company_id`, `balance`, `created_at`, `type`, `available_amount`, `id`, `status`, `activated_amount`, `merchant_id`, `currency`, `blocked_amount`) VALUES ("d2297748-10c6-11ee-be56-0242ac120002", 99.99, TIMESTAMP"2023-07-10T11:41:23.3128747Z", "PERSONAL", 0, "282de495-94eb-4d0c-88cc-eabfd1ab246f", "ACTIVE", 0, "2c2f18de-10c6-11ee-be56-0242ac120002", "EUR", 0);
INSERT INTO`account_owner` (`account_id`, `consumer_id`) VALUES ("282de495-94eb-4d0c-88cc-eabfd1ab246f", "791c5120-f641-438a-890e-c0c2686ae9b6");
INSERT INTO`consumer` (`merchant_id`, `status`, `company_id`, `created_at`, `external_id`, `id`, `type`) VALUES
("2c2f18de-10c6-11ee-be56-0242ac120002", "ACTIVE", "d2297748-10c6-11ee-be56-0242ac120002", TIMESTAMP"2023-07-10T11:41:23.2741788Z", "USER1", "791c5120-f641-438a-890e-c0c2686ae9b6", "INDIVIDUAL");
As you see tables itself are created correctly consumer, account, account_owner
But data of those tables are exported in alphabetic order of tables: account, account_owner, consumer
This leads to SQL problems during import because data from account_owner is trying to set foreign key to consumer table record, but this record doesn't exists yet
The text was updated successfully, but these errors were encountered:
Yep this is exactly what I'm doing right now. But it is rather workaround.
Would be great if I could execute spanner-dump once with preferred order of tabled to dump set in --tables parameter like: spanner-dump ... --tables=consumer,account,account_owner
Unfortunately it doesn't work like that and data is dumped alphabetically
It looks data are dumped from tables in alphabetic orders therefore sometimes created dump cannot be imported.
As you see tables itself are created correctly
consumer
,account
,account_owner
But data of those tables are exported in alphabetic order of tables:
account
,account_owner
,consumer
This leads to SQL problems during import because data from
account_owner
is trying to set foreign key toconsumer
table record, but this record doesn't exists yetThe text was updated successfully, but these errors were encountered: