如何使用config()中的post_hook param在特定DBT模型的末尾运行Python脚本?
我希望只能在特定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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你今天不能这样做。 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)