使用where语句在DBT中的表中更新特定单元格
嗨,我有下表销售
国家 /地区 | 销售 | 销售_DATE |
---|---|---|
US | 2 | 12-06-2022 |
JP | 2 | 15-06-2022 |
我必须编写一个SQL查询来更新DBT中的Paticular Cell。我想为我们更改sale_date。
现在我的查询是 -
UPDATE `sales`
SET
Sale_Date = '2022-06-16'
WHERE
Country = 'US'
但是,在DBT中,我会得到以下错误,
Server error: Database Error in rpc request (from remote system)
Syntax error: Expected end of input but got keyword LIMIT at [4:1]
我缺少什么?我是DBT的新手。
Hi I have a following table Sales
Country | Sales | Sale_Date |
---|---|---|
US | 2 | 12-06-2022 |
JP | 2 | 15-06-2022 |
I have to write a SQL query to update the paticular cell in dbt. I want to change Sale_Date for US.
Now my query is-
UPDATE `sales`
SET
Sale_Date = '2022-06-16'
WHERE
Country = 'US'
However, In dbt I get 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]
What am I missing? I am fairly new to dbt.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DBT被认为主要与
选择
语句一起使用。您可以找到更多上下文在这里。您可能要做的就是只使用
选择
语句进行以下操作。包含一个带有
Update
的列,类似于您需要的转换。dbt is thought to mainly be used with
SELECT
statements. You can find a bit more context here.What you might want to do is to just apply that transformation using a
SELECT
statement as follows:So now, you will have a dbt model materialized either as a view, a table, or whatever you prefer, that contains a column with the
UPDATE
-like transformation that you needed.