Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add retry and timeout for batch dml #1107

Merged
merged 7 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(spanner): update comments
  • Loading branch information
harshachinta committed Mar 6, 2024
commit 74279ba52605e1ce61b6a7806b74fa9de03b3e0c
7 changes: 7 additions & 0 deletions samples/samples/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2807,13 +2807,20 @@ def set_custom_timeout_and_retry(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

# Customize retry with an initial wait time of 5 seconds.
# Customize retry with a maximum wait time of 100 seconds.
# Customize retry with a wait time multiplier per iteration of 2.
# Customize retry with a timeout on
# how long a certain RPC may be retried in case the server returns an error.
retry = Retry(initial=5, maximum=100, multiplier=2, timeout=60)
harshachinta marked this conversation as resolved.
Show resolved Hide resolved

# Set a custom retry and timeout setting.
with database.snapshot() as snapshot:
results = snapshot.execute_sql(
"SELECT SingerId, AlbumId, AlbumTitle FROM Albums",
# Set custom retry setting for this request
retry=retry,
# Set custom timeout setting for this request
timeout=60,
)

Expand Down