使用DBT更新BigQuery的表格
我正在尝试使用DBT更新BigQuery的表。以下命令在BigQuery执行;
Update {{ ref('my_table') }}
SET variable = 'value'
WHERE lower(variable) LIKE '%XX%' or lower(variable) like '%YY%'
但是,当我在DBT中运行它时,我会收到以下错误,
Server error: Database Error in rpc request (from remote system)
Syntax error: Expected end of input but got keyword LIMIT at [4:1]
有人知道为什么会发生这种情况以及如何解决吗?
I am trying to update a table in bigquery using DBT. The below command executes in bigquery;
Update {{ ref('my_table') }}
SET variable = 'value'
WHERE lower(variable) LIKE '%XX%' or lower(variable) like '%YY%'
However when I run it in DBT I get the following error
Server error: Database Error in rpc request (from remote system)
Syntax error: Expected end of input but got keyword LIMIT at [4:1]
Does anyone know why this is happening and how to resolve?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
起初我知道这有点不直觉是一个选择语句。
相反,您应该考虑做类似:
或更简单的事情:
仅仅是因为在
dbt Run
循环中,新值将被实现为新模型。但是,如果您正在寻找以干燥方式清洁基础桌子的方法,我强烈推荐此线程建模SQL Update语句来自DBT话语的一些模式,以管理处理特定价值清洁的语句。凯尔·里斯(Kyle Ries)的例子:
It's a little unintuitive at first I know but with dbt, every model is a select statement.
You should instead think of doing something like:
Or possibly even simpler:
Simply because during the
dbt run
cycle, the new values will be materialized into the new model.However, if you are looking for ways to clean underlying tables in a DRY way, I'd highly recommend this thread Modeling SQL Update Statements from the dbt discourse for some patterns on managing statements which handle specific value cleaning. Example from Kyle Ries: