Skip to content

Commit a248c00

Browse files
authored
docs: remove redundant bigquery_update_table_expiration code sample
New version of this sample added in #1457 and migrated to in the docs in internal change 570781706.
1 parent 53aad82 commit a248c00

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

docs/snippets.py

-46
Original file line numberDiff line numberDiff line change
@@ -201,52 +201,6 @@ def test_update_table_description(client, to_delete):
201201
# [END bigquery_update_table_description]
202202

203203

204-
@pytest.mark.skip(
205-
reason=(
206-
"update_table() is flaky "
207-
"https://github.com/GoogleCloudPlatform/google-cloud-python/issues/5589"
208-
)
209-
)
210-
def test_update_table_expiration(client, to_delete):
211-
"""Update a table's expiration time."""
212-
dataset_id = "update_table_expiration_dataset_{}".format(_millis())
213-
table_id = "update_table_expiration_table_{}".format(_millis())
214-
project = client.project
215-
dataset_ref = bigquery.DatasetReference(project, dataset_id)
216-
dataset = bigquery.Dataset(dataset_ref)
217-
client.create_dataset(dataset)
218-
to_delete.append(dataset)
219-
220-
table = bigquery.Table(dataset.table(table_id), schema=SCHEMA)
221-
table = client.create_table(table)
222-
223-
# TODO(thejaredchapman): After code sample has been updated from cloud.google.com delete this.
224-
225-
# [START bigquery_update_table_expiration]
226-
import datetime
227-
228-
# from google.cloud import bigquery
229-
# client = bigquery.Client()
230-
# project = client.project
231-
# dataset_ref = bigquery.DatasetReference(project, dataset_id)
232-
# table_ref = dataset_ref.table('my_table')
233-
# table = client.get_table(table_ref) # API request
234-
235-
assert table.expires is None
236-
237-
# set table to expire 5 days from now
238-
expiration = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
239-
days=5
240-
)
241-
table.expires = expiration
242-
table = client.update_table(table, ["expires"]) # API request
243-
244-
# expiration is stored in milliseconds
245-
margin = datetime.timedelta(microseconds=1000)
246-
assert expiration - margin <= table.expires <= expiration + margin
247-
# [END bigquery_update_table_expiration]
248-
249-
250204
@pytest.mark.skip(
251205
reason=(
252206
"update_table() is flaky "

0 commit comments

Comments
 (0)