Cloud Spanner View doesn't allow DML statements, so spanner-dump must exclude Views from dump data. Currently tables are fetched from INFORMATION_SCHEMA.TABLES and it can contain view tables.
Before:
$ spanner-dump -p ${PROJECT} -i ${INSTANCE} -d ${DATABASE}
CREATE TABLE Singers (
SingerId INT64 NOT NULL,
FirstName STRING(1024),
LastName STRING(1024),
SingerInfo BYTES(MAX),
) PRIMARY KEY(SingerId);
CREATE VIEW SingerNames SQL SECURITY INVOKER AS SELECT
Singers.SingerId AS SingerId,
Singers.FirstName || " " || Singers.LastName AS Name
FROM Singers;
INSERT INTO `SingerNames` (`SingerId`, `Name`) VALUES (1, "foo bar");
INSERT INTO `Singers` (`SingerId`, `FirstName`, `LastName`, `SingerInfo`) VALUES (1, "foo", "bar", NULL);
After:
Note that INSERT INTO SingerNames statement is removed.
$ spanner-dump -p ${PROJECT} -i ${INSTANCE} -d ${DATABASE}
CREATE TABLE Singers (
SingerId INT64 NOT NULL,
FirstName STRING(1024),
LastName STRING(1024),
SingerInfo BYTES(MAX),
) PRIMARY KEY(SingerId);
CREATE VIEW SingerNames SQL SECURITY INVOKER AS SELECT
Singers.SingerId AS SingerId,
Singers.FirstName || " " || Singers.LastName AS Name
FROM Singers;
INSERT INTO `Singers` (`SingerId`, `FirstName`, `LastName`, `SingerInfo`) VALUES (1, "foo", "bar", NULL);
Cloud Spanner View doesn't allow DML statements, so spanner-dump must exclude Views from dump data. Currently tables are fetched from INFORMATION_SCHEMA.TABLES and it can contain view tables.
Before:
After:
Note that
INSERT INTO SingerNames
statement is removed.