Skip to content

Spanner: StreamedResult.rows() is confusing and error prone #4414

@vkedia

Description

@vkedia

One of Cloud Spanner customers had a bug where they were iterating on StreamedResultSet.rows and were not getting any data back:

result = transaction.execute_sql(query)
        # here result.rows is empty
        for row in result.rows:
            print(row) # prints nothing

This is kind of working as intended because result.rows will only contain data when consume_next or consume_all is called. But it is still a very confusing API and easy to get wrong. It is also not clear to me at any point in time what rows will be present in this list.
I think we should make the rows private and not expose it to the user. We should do it before marking the library as GA as this is a breaking change.

cc @lukesneeringer @tseaver @danoscarmike

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions