DBT重复检查忽略模式

发布于 2025-02-01 11:02:13 字数 1035 浏览 2 评论 0原文

dbt编译中,有一个模型重复检查,以确保模型不会彼此踩到。这张检查使我有问题。

我们的体系结构

我们的系统描述了处理到不同模式的阶段,我们希望开始使用DBT。因此,说我们正在导入一个原始数据集,我们正在调用jaffles,我们将拥有一个raw.jaffles表,clean> clean.jaffles表格,依此类推。注意RAW在此示例中清洁是不同的模式。

问题

这打破了重复检查。无论我如何自定义架构名称或i 呼叫参考,重复检查发生在触摸任何一个之前,请注意我们有两个名为“ jaffles”的型号不同的模式,并引发错误。

可能的解决方案

  • 理想情况下,我会自定义它如何解决用于检查重复的路径以包括模式。但是我找不到如何自定义该部分。
  • 可能我可以完全跳过此支票,然后自己进行完整性检查。但是我找不到禁用此问题的选项。
  • 我看到的唯一可以使用的解决方案是将每个视图重命名为唯一,这将是我们已经建立的一项超级清洁命名约定的很多工作。

During dbt compile, there is a model duplication check to be sure models aren’t stepping on top of each other. This check is causing me problems.

Our Architecture

Our system delineates the stages of processing into different schemas, and we're wanting begin using dbt. So, say we’re importing a raw dataset we’re calling jaffles, we’ll have a raw.jaffles table, a clean.jaffles table, and so on. Note raw and clean in this examples are different schemas.

The Problem

This breaks the duplication check. No matter how I customize the schema names, or how I call ref, the duplication check happens before touching any of that, notices we have two models named “jaffles”, ignores that they wouldn’t actually collide from being in different schemas, and throws an error.

Possible Solutions

  • Ideally, I'd customize how it solves for the paths it uses to check duplication to include schema. But I can't find how to customize that part.
  • Possibly I could skip this check altogether and do the integrity check myself. But I couldn't find options to disable this.
  • The only solution I'm seeing that could work is to rename each of the views to be unique, and this would be a lot of work polluting an otherwise super-clean naming convention we already have established.

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

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

发布评论

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

评论(1

梦罢 2025-02-08 11:02:14

docs ,即使它们在不同的文件夹中”。

但是,您可以做的是使用自定义别名(请参阅 docs ),您可以在2个或更多不同的模式中重新使用相同的表/查看名称。在您的示例中,您可以拥有两个不同的模型,它们每个模型都分配了一个:

-- models/.../raw_jaffles.sql
{{ config(alias='jaffles', schema='raw') }}
-- models/.../clean_jaffles.sql
{{ config(alias='jaffles', schema='clean') }}

但是,文件名仍然需要与另一个不同。

As stated in the docs, "model names need to be unique, even if they are in distinct folders".

What you could do, though, is to use custom aliases (see the docs), where you can re-use the same table/view name within 2 or more different schemas. In your example, you could have two different models that have a specific schema assigned each:

-- models/.../raw_jaffles.sql
{{ config(alias='jaffles', schema='raw') }}
-- models/.../clean_jaffles.sql
{{ config(alias='jaffles', schema='clean') }}

Nevertheless, the file names still need to be different one from the other.

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