Skip to content

Spanner: Add API for binding lists of tuples into queries #2759

@Macil

Description

@Macil

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.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions