def model(dbt, session): dbt.config( materialized='table', tags=['python_model'], ) dbt.ref("dependency_model") try: df = session.read.format('jdbc') .option('url', ...).option(...) .option('driver', 'oracle.jdbc...') .load() except Exception as e: raise e return df 1 2 3 pipenv run dbt run --target=dev --select tag:python_model Tips Execution control via tags Just like dbt SQL models, execution can be controlled via tags Dependency management via dbt.ref Dependencies between models can be managed with dbt.ref, and it can be used together with SQL models Data ingestion Python handles tasks difficult in SQL, such as ingesting Oracle tables, PL/SQL execution results, and Excel files 1 2 3 We use dbt Python models to prepare ground-truth data. Flexible processing that is hard to express in dbt SQL models can be written in Python, and it can also run as a Databricks Notebook Job.