8000 add pagination sample · larkee/python-docs-samples@39ee4d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39ee4d9

Browse files
committed
add pagination sample
1 parent 447ad6b commit 39ee4d9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

spanner/cloud-client/backup_sample.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ def list_backups(instance_id, database_id, backup_id):
190190
filter_="create_time >= \"{}-{}-{}T{}:{}:{}Z\" AND state:READY".format(
191191
*create_time.timetuple())):
192192
print(backup.name)
193+
194+
print("All backups with pagination")
195+
for page in instance.list_backups(page_size=2).pages:
196+
for backup in page:
197+
print(backup.name)
193198
# [END spanner_list_backups]
194199

195200

spanner/cloud-client/backup_sample_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_list_backups(capsys, spanner_instance):
9696
backup_sample.list_backups(INSTANCE_ID, DATABASE_ID, BACKUP_ID)
9797
out, _ = capsys.readouterr()
9898
id_count = out.count(BACKUP_ID)
99-
assert id_count == 6
99+
assert id_count == 7
100100

101101

102102
def test_delete_backup(capsys, spanner_instance):

0 commit comments

Comments
 (0)
0