I've started playing around with the Spanner Python client (on appengine flex), but I'm hitting a few walls when trying to reuse the doc examples. One issue I'm facing is trying to read the database:
execute_sql() returns empty sets (even with a simple 'SELECT 1' query)
with database.snapshot() as snapshot: QUERY = ('SELECT 1') result = snapshot.execute_sql(QUERY) for row in result.rows: print(row)
read() returns a "AttributeError: 'list' object has no attribute 'to_pb'" error, whether I
try to build the whole keyset as a dictionary
keyset = {'keys': ['f0_'], 'ranges': [{'startClosed': [], 'endClosed': [500]}], 'all': False}
passing value lists directly
keyset = [0, 1, 2]
and an attempt at using the Keyset() constructor tells me that spanner does not have a keyset member AttributeError: 'module' object has no attribute 'keyset'
keys = ['f0_'] ranges = spanner.keyset.KeyRange(start_closed=[], end_closed=[500]) keyset = { 'keys': keys, 'ranges': ranges, 'all': False} keyset = spanner.keyset.Keyset(keys=keys, ranges=[range])
So I'm a bit stuck, and I'm wondering whether there's something I'm doing wrong or the examples / docs need a bit of spolishing... Any help appreciated :)