DBT:使用' this'功能在编译/预览中具有不同的结果

发布于 2025-02-07 16:09:20 字数 555 浏览 0 评论 0原文

使用DBT Web IDE时,我在{{this}}}函数中看到不同的行为时,当我使用预览或编译时,而不是使用dbt Run构建模型。当我使用预览或编译时,模型名称始终为request,但是当我使用dbt Run构建模型时,它会正确解析模型名称。

例如,在my_model.sql中:

{{ this.database }}
{{ this.schema }}
{{ this.name }}

dev_db
public
request

如果我运行dbt run -s my_model,在运行的详细信息中:

dev_db
public
my_model

我的问题是我如何获得我的行为预览/编译以匹配dbt Run的编译?我希望{{{this.name}}正确解析为my_model

When using the DBT web IDE, I'm seeing different behavior in the {{ this }} function when I use preview or compile as opposed to building the model with dbt run. When I use preview or compile, the model name is always request, but when I build the model with dbt run, it correctly resolves the model name.

For example, in my_model.sql:

{{ this.database }}
{{ this.schema }}
{{ this.name }}

dev_db
public
request

If I run dbt run -s my_model, in the details of the run I see:

dev_db
public
my_model

My question is how can I get the behavior of preview/compile to match that of dbt run? I would like {{ this.name }} to correctly resolve to my_model.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝情姑娘 2025-02-14 16:09:20

我认为,当您在IDE中击中“编译”或“运行”时,它只会将编辑器窗口的内容拿走,然后编译或编译或运行它,而与文件本身无关。在某些情况下,这是有道理的,例如,我可以启动一个新的选项卡并“运行”它而无需保存作为文件。

因此,似乎正在获取临时名称请求而不是模型的名称。

我不知道DBT Labs是否会认为这是一个错误,可能是设计出来的,但是对他们的支持可能是您最好的下一步。

I think when you hit 'compile' or 'run' in the IDE, it just takes the contents of your editor window and compiles or compiles/runs it, independent of the file itself. In some cases this makes sense, eg I can start a new tab and 'run' it without saving it as a file.

Because of this, it seems like it's getting the temporary name request rather than the name of the model.

I don't know if dbt Labs would consider this a bug, likely more it's by design, but speaking to their support is probably your best next step.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文