在BigQuery中,last_modified_timestamp是指表或视图上次修改的时间戳。当对表或视图进行更改操作时,该时间戳会被更新。这对于跟踪数据变化和表的时间敏感性分析非常有用。
以下是获取特定表的last_modified_timestamp的代码示例。请确保您已经设置了适当的Google Cloud凭证来读取BigQuery数据。
from google.cloud import bigquery
# 设置Google Cloud凭证
client = bigquery.Client.from_service_account_json('path/to/credentials.json')
# 获取特定表的last_modified_timestamp
dataset_id = 'my_dataset'
table_id = 'my_table'
table = client.get_table(f'{client.project}.{dataset_id}.{table_id}')
last_modified_timestamp = table.modified
print(f'Last modified timestamp for table {table_id}: {last_modified_timestamp}')