Skip to content

spanner read with timestamp fails #4215

@pascaldelange

Description

@pascaldelange

I am running into the problem described here.

When reading from a Spanner table in a snapshot with timestamps, using the code below

import datetime as dt
from google.cloud.spanner_v1.client import Client

proj = 'my_project'
inst = 'my_instance'
db = 'my_database'

datetime_now = dt.datetime.now()
with Client(proj).instance(inst).database(db).snapshot(
                     read_timestamp=datetime_now) as snapshot: # this fails
#with Client(proj).instance(inst).database(db).snapshot() as snapshot: # this works
    result = snapshot.execute_sql('SELECT t.table_name FROM information_schema.tables AS t')
    for row in result:
        print row

the read either fails with

  File "spanner_test.py", line 12, in <module>
    for row in result:
  File "/Users/pascal/Documents/enviroments/py27/lib/python2.7/site-packages/google/cloud/spanner/streamed.py", line 167, in __iter__
    self.consume_next()  # raises StopIteration
  File "/Users/pascal/Documents/enviroments/py27/lib/python2.7/site-packages/google/cloud/spanner/streamed.py", line 132, in consume_next
    response = six.next(self._response_iterator)
  File "/Users/pascal/Documents/enviroments/py27/lib/python2.7/site-packages/grpc/_channel.py", line 351, in next
    return self._next()
  File "/Users/pascal/Documents/enviroments/py27/lib/python2.7/site-packages/grpc/_channel.py", line 342, in _next
    raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.DEADLINE_EXCEEDED, Deadline Exceeded)>

when using spanner v0.26 or simply goes on forever and blocks my terminal with spanner v0.28.
I am using python v2.7.13, google-cloud v0.27 and the spanner API in versions 0.26/0.28.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions