diff --git a/docs/spanner/batch-usage.rst b/docs/spanner/batch-usage.rst index 1bdce70e5342d..b22c3b832c12d 100644 --- a/docs/spanner/batch-usage.rst +++ b/docs/spanner/batch-usage.rst @@ -124,8 +124,14 @@ rows do not cause errors. .. code:: python - batch.delete('citizens', - keyset['bharney@example.com', 'nonesuch@example.com']) + from google.cloud.spanner.keyset import KeySet + + to_delete = KeySet(keys=[ + ('bharney@example.com',) + ('nonesuch@example.com',) + ]) + + batch.delete('citizens', to_delete) Commit changes for a Batch @@ -151,6 +157,13 @@ if the ``with`` block exits without raising an exception. .. code:: python + from google.cloud.spanner.keyset import KeySet + + to_delete = KeySet(keys=[ + ('bharney@example.com',) + ('nonesuch@example.com',) + ]) + with session.batch() as batch: batch.insert( @@ -169,8 +182,7 @@ if the ``with`` block exits without raising an exception. ... - batch.delete('citizens', - keyset['bharney@example.com', 'nonesuch@example.com']) + batch.delete('citizens', to_delete) Next Step