dbt表的别名不起作用,并且给出错误`dataset.table与任何节点不匹配
我有三个包含具有相同名称的表的数据集。以下 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很难确切知道,因为您没有共享运行的命令,所使用的仓库或确切的错误消息。
但是我猜这是试图执行
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 usedbt 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 useref
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.