[英]How can I run a python script at the end of a specific DBT model, using the post_hook param within config()?
I would like to be able to run a python script only at the end of a specific DBT model.我希望能够仅在特定 DBT 模型的末尾运行 python 脚本。 My idea is to use post_hook parameter from config() function of that specific model.
我的想法是使用该特定模型的 config() 函数中的 post_hook 参数。
Is there a way to do this?有没有办法做到这一点?
You cannot do this today.你今天不能这样做。 dbt does not provide a Python runtime.
dbt 不提供 Python 运行时。
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.根据您部署 dbt 的方式,您可以为此使用 fal(开源或云): https ://fal.ai/ 或其他(更重的)编排器,如 Airflow、Dagster 或 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您还应该知道,有一个关于外部节点和/或可执行公开的积极讨论可以解决这个用例: 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; dbt 还计划在不久的将来发布Python 语言模型,但这不太可能解决这个用例; that Python will be executed in your Warehouse environment, and may or may not be able to make arbitrary web requests (eg, Snowpark is really just dataframe-python that gets transpiled to SQL)
Python 将在您的 Warehouse 环境中执行,并且可能会或可能不会发出任意 Web 请求(例如,Snowpark 实际上只是转换为 SQL 的 dataframe-python)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.