Reputation: 75
Google's Spanner supports SQL "bulk" Inserts e.g. from doco
INSERT INTO Singers (SingerId, FirstName, LastName) VALUES(1, 'Marc', 'Richards'), (2, 'Catalina', 'Smith'), (3, 'Alice', 'Trentor');
However I cannot find any support for this in the Go Client. The Go Client "Statement" type supports single-row inserts and I have used the BatchUpdate() function to execute a batch of single-row inserts, but I cannot find any support for bulk-inserts.
Does the Spanner Client support bulk inserts ?
Upvotes: 1
Views: 1612
Reputation: 3512
Yes, there are a number of ways that you can do that:
BatchUpdate
method to execute a collection of individual INSERT
statements. An example can be found here.INSERT
statement that inserts multiple rows by calling the Update
method with a SQL string that inserts multiple rows. An example can be found here.Apply
method to insert a collection of (insert) mutations. An example can be found hereUpvotes: 2