问题描述
最近我们测试失败了,它为BigQuery提出了一个问题一致性模型:创建表之后,其他操作是否应立即查看该表?
背景:
我们的测试使用一些数据在BigQuery中创建一个表格,等待作业完成,然后检查表格是否存在。
gbq.write_gbq(df,dataset_id,table_name,project_id = project_id,block = True)
在gbq.list_tables中声明table_name(dataset_id,project_id = project_id)#失败
FYI block = True
运行 wait_for_job
,等待作业完成。应该在创建后立即使用。
但我怀疑这个问题不适用于BigQuery。
请注意,在, tables.list()
操作具有 nextPageToken 参数。您可能必须使用它才能检索数据集中的所有表。
这有一个关于如何使用它的例子。基本上,当页面令牌被定义的时候,并不是所有的表都已经被列出。
We have recently had a test failing, and it brings up a question consistency model for BigQuery: After we create a table, should other operations immediately see that table?
Background:Our test creates a table in BigQuery with some data, waits for the job to complete, and then checks whether the table exists.
gbq.write_gbq(df, dataset_id, table_name, project_id=project_id, block=True)
assert table_name in gbq.list_tables(dataset_id, project_id=project_id) # fails
FYI block=True
runs wait_for_job
, so waits for the job to complete.
Yes, the table should be ready for usage just after creation.
But I suspect that the issue is not with BigQuery.
Notice that in the docs, the tables.list()
operation have this nextPageToken parameter. You probably will have to use it in order to retrieve all tables in your dataset.
This code has one example on how to use it. Basically while there's a pageToken being defined then not all tables have been listed yet.
这篇关于Google BigQuery中的表格一致性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!