Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bigtable/docs/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ def test_bigtable_update_cluster():

def test_bigtable_create_table():
# [START bigtable_create_table]
from google.api_core import exceptions
from google.api_core import retry
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family

Expand All @@ -403,7 +405,13 @@ def test_bigtable_create_table():
table = instance.table("table_my")
# Define the GC policy to retain only the most recent 2 versions.
max_versions_rule = column_family.MaxVersionsGCRule(2)
table.create(column_families={"cf1": max_versions_rule})

# Could include other retriable exception types
# Could configure deadline, etc.
predicate_504 = retry.if_exception_type(exceptions.DeadlineExceeded)
retry_504 = retry.Retry(predicate_504)

retry_504(table.create)(column_families={"cf1": max_versions_rule})
# [END bigtable_create_table]

try:
Expand Down