与使用存储过程方法相比,DBT的使用情况如何?

发布于 2025-02-05 16:49:22 字数 317 浏览 1 评论 0原文

我已经很长时间以来一直使用存储过程方法。

作为销售报告生成的一部分,我创建存储过程 join/inoun all数据库中的mulitple表,并使用python使用它。

现在DBT如今是一个热门话题。

存储过程移动到dbt的优点是什么? 将我的整个存储过程迁移有任何意义从存储的proc到dbt

I have been using stored procedure method for a long time now.

As a part of sales report generation, I create stored procedures to join/union all mulitple tables in database and call it using python whenever i need it.

Now DBT is a hot topic these days.

Whats the advantage of moving to DBT from stored procedures ?
Is there any point in migrating my entire stored procedure stack from stored proc to DBT?

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

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

发布评论

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

评论(2

长不大的小祸害 2025-02-12 16:49:22

DBT的一些主要好处是:

  1. 与版本控件(如GIT)集成
  2. 对多种环境(DEV和POD)
  3. 依赖关系管理和DAG构造的
  4. 支持很容易重建模型的一部分,并使用简单选择语法
  5. 自动化测试
  6. Jinja模板
  7. 可重新使用,复杂的逻辑等复杂的逻辑化和快照
  8. 自动生成的文档网站

更多信息在其 Docs 以及其网站上的营销材料GetDbt.com

Some of the major benefits of dbt are:

  1. Integration with version control (like git)
  2. Support for multiple environments (dev and prod)
  3. Dependency management and dag construction
  4. Easily rebuild only a subset of your models with simple selection syntax
  5. Automated testing
  6. Jinja templating
  7. Re-usable, complex logic like incremental materializations and snapshots
  8. An auto-generated documentation website

More info in their docs and marketing materials on their website, getdbt.com

梦幻之岛 2025-02-12 16:49:22

如您所确定的,DBT在功能上与存储过程相似,并带有一些附加功能。

为了拥有DBT提供的功能,源控制等。数据库之外存在DBT。尽管您可能会获得DBT的功能,但您还将失去存储过程的功能,例如,使用临时表,变量或创建参数化查询的功能。

您还将受到DBT使用视图来执行和管理查询的限制。这将您限制在视图中的DB允许允许的语言中,并且与使用过程相比,您将没有更多的选择来提高查询性能。

请记住,DBT中功能的某些功能有许多主要DBS:

  • 依赖关系管理 - 大多数DBS都有系统表,可以告诉您数据库对象如何引用另一个数据库对象。这些可以以向前和向后显示依赖性的方式进行查询。
  • 模板SQL -Dynamic SQL。
  • 可重复使用的逻辑 - 功能和视图。
  • 测试 - 这可以通过存储过程来实现。一个很好的例子是 tsqlt SQL Server的框架。 DBT中的测试是由DBT运行的查询。

As you've identified, dbt is functionally similar to a stored procedure, with some extras.

In order to have the functionality offered by dbt, source control etc. dbt exists outside of the database. While you might gain the features of dbt, you will also lose the functionality of a stored procedure, e.g., the ability to use temp tables, variables, or create parameterized queries.

You will also be constrained by dbt's use of Views to execute and manage queries. This limits you to language features your DB permits in Views and you wont have as many options to improve query performance than you would if you use a procedure.

Keep in mind that some of the functionality in dbt is available many major DBs:

  • Dependency management - most DBs have system tables that can tell you how a Database object references another Database object. These can be queried in a way that shows dependencies forward and back.
  • Templated SQL - Dynamic sql.
  • Reusable logic - Functions and views.
  • Tests - This can be achieved with stored procedures. A very good example of this is the tSQLt framework for sql server. Tests in dbt are queries run by dbt.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文