Skip to content

Commit a6d121e

Browse files
authored
Updates to using Airflow with dbt. (#651)
1 parent 2de4bd2 commit a6d121e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

docs/integrations/dbt.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,29 @@ Add SQLMesh [unit tests](../concepts/tests.md) to a dbt project by placing them
8282
## Using Airflow
8383
To use SQLMesh and dbt projects with Airflow, first configure SQLMesh to use Airflow as described in the [Airflow integrations documentation](./airflow.md).
8484
85-
Then, add the following to `config.py` within the project root directory:
85+
Then, install dbt-core within airflow.
86+
87+
Finally, replace the contents of `config.py` with:
8688
8789
```bash
88-
> airflow_config = sqlmesh_config(Path(__file__).parent, scheduler=AirflowSchedulerConfig())
90+
> from pathlib import Path
91+
>
92+
> from sqlmesh.core.config import AirflowSchedulerConfig
93+
> from sqlmesh.dbt.loader import sqlmesh_config
94+
>
95+
> config = sqlmesh_config(
96+
> Path(__file__).parent,
97+
> scheduler=AirflowSchedulerConfig(
98+
> airflow_url="https://<Airflow Webserver Host>:<Airflow Webserver Port>/",
99+
> username="<Airflow Username>",
100+
> password="<Airflow Password>",
101+
> )
102+
> )
89103
```
90104
91-
See the [Airflow configuration documentation](https://airflow.apache.org/docs/apache-airflow/2.1.0/configurations-ref.html) for a list of all AirflowSchedulerConfig configuration options.
105+
See the [Airflow configuration documentation](https://airflow.apache.org/docs/apache-airflow/2.1.0/configurations-ref.html) for a list of all AirflowSchedulerConfig configuration options. Note: only the python config file format is supported for dbt at this time.
106+
107+
The project is now configured to use airflow. Going forward, this also means that the engine configured in airflow will be used instead of the target engine specified in profiles.yml.
92108
93109
## Supported dbt jinja methods
94110

0 commit comments

Comments
 (0)