Skip to content

Commit

Permalink
Update spanner docs to show correct 'Batch.delete' usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver authored and landrito committed Aug 22, 2017
1 parent fad80a2 commit 569b247
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/spanner/batch-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit 569b247

Please sign in to comment.