Skip to content
Permalink
Browse files
docs: fix snapshot usage (#291)
Fix a wrong keyword argument `key_set`.
Correctly, it is `keyset`, and the value must be a instance of `spanner.KeySet()`.

`snapshot.read()` and `snapshot.execute_sql()` returns an iterable.
It does not have `rows` attribute.
  • Loading branch information
kit494way committed Mar 25, 2021
1 parent baa02ee commit eee218164c3177586b73278aa21495280984af89
Showing with 4 additions and 4 deletions.
  1. +4 −4 docs/snapshot-usage.rst
@@ -65,16 +65,16 @@ Read Table Data

To read data for selected rows from a table in the database, call
:meth:`~google.cloud.spanner_v1.snapshot.Snapshot.read` which will return
all rows specified in ``key_set``, or fail if the result set is too large,
all rows specified in ``keyset``, or fail if the result set is too large,

.. code:: python
with database.snapshot() as snapshot:
result = snapshot.read(
table='table-name', columns=['first_name', 'last_name', 'age'],
key_set=['phred@example.com', 'bharney@example.com'])
keyset=spanner.KeySet([['phred@example.com'], ['bharney@example.com']]))
for row in result.rows:
for row in result:
print(row)
.. note::
@@ -100,7 +100,7 @@ result set is too large,
'WHERE p.employee_id == e.employee_id')
result = snapshot.execute_sql(QUERY)
for row in list(result):
for row in result:
print(row)
.. note::

0 comments on commit eee2181

Please sign in to comment.