如何从python api更新/删除Bigquery中的行?

时间:2022-08-24 15:24:30

I'm designing a BigQuery job in python that updates and inserts into several tables. I thought of two ways to achieve that:

我正在python中设计一个BigQuery作业,它可以更新并插入到几个表中。我想到了两种实现方法:

  1. execute a query job and save the result into a temporary table with an update/insert indicator and process them after. But it's no clear how to update with python libraries.

    执行查询作业并将结果保存到具有更新/插入指示符的临时表中,然后处理它们。但目前还不清楚如何使用python库进行更新。

  2. load the whole data into a new partitioned table and skip updates/inserts. It takes a more space then I would like but partition expires in few days anyway.

    将整个数据加载到新的分区表中并跳过更新/插入。它需要更多空间然后我想,但分区在几天内到期。

Am I missing something? Is there other way to achieve this?

我错过了什么吗?有没有其他方法来实现这一目标?

1 个解决方案

#1


0  

The method to update fields in python is implemented in idiomatic library, it's called update_table(). It calls into BigQuery API's patch method.

在python中更新字段的方法是在惯用库中实现的,它叫做update_table()。它调用了BigQuery API的补丁方法。

#1


0  

The method to update fields in python is implemented in idiomatic library, it's called update_table(). It calls into BigQuery API's patch method.

在python中更新字段的方法是在惯用库中实现的,它叫做update_table()。它调用了BigQuery API的补丁方法。