选择“删除”列名称。在DBT查询中以创建视图
我正在尝试在DBT中创建视图。源表有一个名为delete
的列。如何在DBT中的选择查询中选择此列?
我尝试过:
select id, delete from src_table;
select id, "delete" from src_table;
select id, "DELETE" from src_table;
select id, DELETE from src_table;
但是他们俩都没有工作。请指教。
I am trying to create a VIEW in dbt. The source table has a column named delete
. How do I select this column in the select query in DBT?
I tried :
select id, delete from src_table;
select id, "delete" from src_table;
select id, "DELETE" from src_table;
select id, DELETE from src_table;
but neither of them worked. Please advise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑您的列实际上并未完全命名
delete
。如果是,那么您将使用选择“删除”
选择它。为了证明这一点,我只是试图重现您的问题,但无法使用此查询:
要准确找出您要选择的列的名称,您可以使用
show列
:然后,您可以选择看起来像
delete
的值,然后将其复制到剪贴板(这显示了SnowSight UI):我怀疑当您时会发现一些空间将该值粘贴到文本编辑器中。
I suspect your column is not actually named exactly
DELETE
. If it were, then you would select it withselect "DELETE"
.To prove that point, I just tried to reproduce your issue, but couldn't with this query:
To find out exactly the name of the column you're trying to select, you could use
show columns
:You can then select the value that looks like
DELETE
and copy it to your clipboard (this is showing the snowsight UI):I suspect you'll find some whitespace when you paste that value into a text editor.
一位同事帮助解决了这个问题。除了将双引号删除外,还需要具有以下模型yaml:
一旦创建了此yaml定义,
选择ID,从src_table
中可以使用。A colleague helped figure this out. In addition to having the delete in double quotes, need to have a model YAML as following:
once this yaml definition is created,
select id, "delete" from src_table
should work.