Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2dded33

Browse files
tswastLinchin
andauthored
docs: remove redundantbigquery_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 <lingqing.gan@gmail.com>
1 parenta40d7ae commit2dded33

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

‎docs/snippets.py‎

Lines changed: 0 additions & 46 deletions
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-
deftest_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-
importdatetime
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-
asserttable.expiresisNone
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-
assertexpiration-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)

[8]ページ先頭

©2009-2025 Movatter.jp