-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spanner: Add API for binding lists of tuples into queries #2759
Description
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 like SELECT * FROM Foo WHERE (a, b) IN @var and 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.