dbt表的别名不起作用,并且给出错误`dataset.table与任何节点不匹配

发布于 2025-02-02 20:14:01 字数 578 浏览 1 评论 0原文

我有三个包含具有相同名称的表的数据集。以下 documentate 使用别名重命名每个表。例如,对于表,我想调用mes_brasil dbt模型是:

{{ config(alias='mes_brasil', schema='br_ibge_ipca') }}
SELECT *
FROM ...

即使文件名是br_ibge_ibge_ipca__mes_brasil.sql。我认为这应该可以起作用。但是,当我运行Flow DBT时,DBT无法识别别名,并给出消息'BR_IBGE_IPCA.MES_BRASIL'与任何节点不匹配。

可以在此处找到整个项目配置:

I have three datasets containing tables with the same name. Following documentation, I use an alias to rename each table. For example, for a table I would like to call mes_brasil the DBT model is:

{{ config(alias='mes_brasil', schema='br_ibge_ipca') }}
SELECT *
FROM ...

even though the file name is br_ibge_ipca__mes_brasil.sql. I think this is supposed to work. However, when I run the flow DBT didn't recognize the alias and gives the message 'br_ibge_ipca.mes_brasil' does not match any nodes.

The whole project configuration can be found here: https://github.com/basedosdados/queries/blob/master/models/br_ibge_ipca/br_ibge_ipca__mes_brasil.sql

What am I doing wrong here?

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

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

发布评论

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

评论(1

阿楠 2025-02-09 20:14:01

很难确切知道,因为您没有共享运行的命令,所使用的仓库或确切的错误消息。

但是我猜这是试图执行dbt运行-s br_ibge_ipca.mes_brasil的警告。在这里,您已经尝试选择一个基于其数据库标识符运行的DBT模型,这是不允许的。相反,您必须使用dbt run -s br_ibge_ibge_ipca__mes_brasil,它是DBT的唯一模型名称。

另外,在您的模型中,您似乎没有使用DBT的{{ref()}}}宏。使用ref很重要,以便DBT可以构建依赖关系图。您可能会看到与未订单构建的节点相关的数据库错误。

It's hard to know exactly, since you didn't share the command you ran, the warehouse you're using, or the exact error message.

But I'm guessing that this is a warning from trying to execute dbt run -s br_ibge_ipca.mes_brasil. Here you've tried to select a dbt model to be run based on its database identifier, which is not allowed. You instead have to use dbt run -s br_ibge_ipca__mes_brasil, which is dbt's unique model name for that model.

Also, in your models, you don't seem to be using dbt's {{ ref() }} macro. It's important to use ref so that dbt can construct a dependency graph. It's possible you're seeing a database error related to nodes that are being built out of order.

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