-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spanner: Add API for binding lists of tuples into queries #2759
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Spanner supports queries with lists of tuples:
SELECT * FROM Foo WHERE (a, b) IN (("x", 1), ("y", 2)). The Spanner API library's Statement builder seems to not support any way of binding the tuple list dynamically into the query. As far as I can tell, there's no way to give it a string likeSELECT * FROM Foo WHERE (a, b) IN @varand construct a query like the one above. (I imagine that value would be given as a List of Struct objects each with "a" and "b" properties.)There's methods for binding various types of arrays (
Statement.newBuilder(...).bind(...).toStringArray(...).build()), but no way to provide an array or list of Struct objects or equivalent.Currently, it seems like I have to dynamically create the query string and escape the values into the string myself.