cloudspannerecosystem / wrench

wrench - Schema management tool for Cloud Spanner -
MIT License
239 stars 46 forks source link

please support `INSERT OR IGNORE` and `INSERT OR UPDATE` syntax #120

Open isso-719 opened 2 weeks ago

isso-719 commented 2 weeks ago

WHAT

Google standard SQL has INSERT OR IGNORE and INSERT OR UPDATE but wrench is not supported. https://cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax#insert-ignore

INSERT OR IGNORE INTO Singers
    (SingerId, FirstName, LastName, Birthdate, Status, SingerInfo)
VALUES (5, "Zak", "Sterling", "1996-03-12", "active", "nationality:'USA'"),
       (7, "Edie", "Silver", "1998-01-23", "active", "nationality:'USA'");
go run github.com/cloudspannerecosystem/wrench apply --dml "./db/testdata/000001.sql" --project local --instance emulator --database singers
Error command: apply, version: v1.10.1
    ./db/testdata/000001.sql:1.10: got "IGNORE" while expecting "("
exit status 1

WHY

We used to delete all data and then insert. This can be simplified with INSERT OR IGNORE.