如何使用config()中的post_hook param在特定DBT模型的末尾运行Python脚本?

发布于 2025-01-31 12:01:40 字数 88 浏览 2 评论 0原文

我希望只能在特定DBT模型的末尾运行Python脚本。 我的想法是使用该特定模型的config()函数使用post_hook参数。

有办法这样做吗?

I would like to be able to run a python script only at the end of a specific DBT model.
My idea is to use post_hook parameter from config() function of that specific model.

Is there a way to do this?

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

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

发布评论

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

评论(1

月光色 2025-02-07 12:01:40

你今天不能这样做。 DBT不提供Python运行时。

根据您的部署方式的不同,您可以使用FAL(开源或云): https://fal.ai/ 或另一个(较重的)编目,例如气流,达格斯特或豪宅。

您还应该知道,对外部节点和/或可执行的暴露有积极的讨论可以解决此用例: https://github.com/dbt-labs/dbt-core/discussions/5073

dbt也计划发布 python语言模型在不久的将来,但这不太可能解决此用例;该python将在您的仓库环境中执行,并且可能无法做出任意的Web请求(例如,Snowpark实际上只是被转移到SQL的DataFrame-Python)

You cannot do this today. dbt does not provide a Python runtime.

Depending on how you deploy dbt, you could use fal for this (either open source or cloud): https://fal.ai/, or another (heavier) orchestrator, like Airflow, Dagster, or Prefect.

You should also know that there is an active Discussion about External Nodes and/or executable exposures that would solve for this use case: https://github.com/dbt-labs/dbt-core/discussions/5073

dbt is also planning to release Python-language models in the near future, but that is unlikely to solve this use case; that Python will be executed in your Warehouse environment, and may or may not be able to make arbitrary web requests (e.g., Snowpark is really just dataframe-python that gets transpiled to SQL)

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