請原諒我問了這么簡單的問題,我被要求代表我一起作業的一些開發人員調查這個問題。
使用 BigQuery API 更新現有表或新表的
后:

代碼示例:
import datetime
from google.cloud import bigquery
client = bigquery.Client(project='elzagales')
project = client.project
dataset_ref = bigquery.DatasetReference(project, 'so_test')
table_ref = dataset_ref.table('table_1')
table = client.get_table(table_ref) # API request
assert table.expires is None
# set table to expire 5 days from now
expiration = datetime.datetime.now(datetime.timezone.utc) datetime.timedelta(
days=5
)
table.expires = expiration
table = client.update_table(table, ["expires"]) # API request
# expiration is stored in milliseconds
margin = datetime.timedelta(microseconds=1000)
assert expiration - margin <= table.expires <= expiration margin
示例參考: https ://cloud.google.com/bigquery/docs/managing-tables#updating_a_tables_expiration_time
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/493180.html
上一篇:將API請求附加到另一個字典
