We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3829f6e commit 9fa614bCopy full SHA for 9fa614b
1 file changed
docs/bigquery/snippets.py
@@ -2157,6 +2157,13 @@ def test_undelete_table(client, to_delete):
2157
# time for recovering the table.
2158
snapshot_time = int(time.time() * 1000)
2159
2160
+ # Because local system time may have some drift, we ensure the snapshot
2161
+ # time is at least within the creation lifespan of the table. Trying
2162
+ # to snapshot a table prior to its creation time is an error.
2163
+ table = client.get_table(table_ref)
2164
+ if table.created_time > snapshot_time:
2165
+ snapshot_time = table.created_time
2166
+
2167
# "Accidentally" delete the table.
2168
client.delete_table(table_ref) # API request
2169
0 commit comments