我用来bigquery批量处理insert我的应用程序中的数据python。这些表格是partitioned在摄入时间。我看到的差异是我插入的数据会在query摄入后 1.5 小时后出现。
后来我改了schema一个timestamp专栏
这次我可以query在摄入后立即获取数据。
为什么表中的_PARTITIONTIME伪列与列之间的行为存在差异?timestampschema
用于摄取的 Python 代码:
这是代码的简化版本:
bigquery_client = bigquery.Client()
TABLE_REF = bigquery_client.dataset('DATASET_ID').table('TABLE_ID')
TABLE = bigquery_client.get_table(TABLE_REF)
def ingest_to_bq(data: LIST[LIST]):
bigquery_client.insert_rows(TABLE, data)
Run Code Online (Sandbox Code Playgroud)
表架构:
[
{
"name": "epoch_ms",
"type": "INTEGER",
"mode": "REQUIRED"
},
{
"name": "application_id",
"type": "STRING",
"mode": "REQUIRED"
},
{
"name": "ack_id",
"type": "STRING",
"mode": "REQUIRED"
},
{
"name": "data",
"type": "STRING",
"mode": "REQUIRED"
}
]
Run Code Online (Sandbox Code Playgroud)
从 …