From eee218164c3177586b73278aa21495280984af89 Mon Sep 17 00:00:00 2001 From: KITAGAWA Yasutaka Date: Thu, 25 Mar 2021 12:54:01 +0900 Subject: [PATCH] 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. --- docs/snapshot-usage.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/snapshot-usage.rst b/docs/snapshot-usage.rst index e088cd0ceb..311ea8f3ca 100644 --- a/docs/snapshot-usage.rst +++ b/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::