我希望从每小时到达的BigQuery中检索数据,并在新的BigQuery表中进行一些处理并提取新的计算变量。事情是,我从来没有与gcp工作过,现在我必须为我的工作。我已经在python中使用我的代码来处理数据,但是它只适用于“静态”数据集
发布于 2020-06-30 02:53:45
由于源和接收器都在BigQuery
中,我建议您在BigQuery
中进行转换。如果需要在预先确定的时间内运行的计划作业,则可以使用预定查询。
通过调度查询,您可以保存一些查询,定期执行它,并将结果保存到另一个表中。
要创建计划好的查询,请执行以下步骤:
- **Schedule options**: there are some pre-configured schedules such as daily, monthly, etc.. If you need to execute it every two hours, for example, you can set the **Repeat** option as **Custom** and set your **Custom schedule** as '_every 2 hours_'. In the **Start date and run time** field, select the time and data when your query should start being executed.
- **Destination for query results**: here you can set the dataset and table where your query's results will be saved. Please keep in mind that this option is not available if you use [scripting](https://cloud.google.com/bigquery/docs/reference/standard-sql/scripting). In other words, you should use only SQL and not scripting in your transformations.
在此之后,您的查询将根据您的计划和目标表配置开始执行。
发布于 2020-06-30 00:21:23
根据谷歌的建议,当您的数据在BigQuery中,以及当您想要转换它们以将它们存储在BigQuery中时,如果您可以用SQL表示处理,用BigQuery进行处理总是更快、更便宜。
这就是为什么,我不推荐您在用例中使用数据流。如果不需要,或者不能直接使用SQL,可以在Javascript中创建BigQuery中的用户定义函数。
编辑
如果在将数据更新为BigQuery时没有任何信息,则Dataflow将无助于此。数据流只能在PubSub中显示这些数据时才能处理实时数据。如果不是,那就不是魔法!
因为您没有执行负载的信息,所以必须按计划运行进程。为此,预定查询是正确的解决方案--您在处理过程中使用BigQuery。
https://stackoverflow.com/questions/62640597
复制