Skip to content

Commit 2dded33

Browse files
tswastLinchin
andauthored
docs: remove redundant bigquery_update_table_expiration code sample (#1673)
New version of this sample added in #1457 and migrated to in the docs in internal change 570781706. Co-authored-by: Lingqing Gan <[email protected]>
1 parent a40d7ae commit 2dded33

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
@@ -203,52 +203,6 @@ def test_update_table_description(client, to_delete):
203203
# [END bigquery_update_table_description]
204204

205205

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

0 commit comments

Comments
 (0)