This repository has been archived.
As a result all of its historical issues and PRs have been closed.
Please do not clone this repo without understanding the risk in doing so:
- It may have unaddressed security vulnerabilities
- It may have unaddressed bugs
Click for historical readme
This repository contains a demo of dbt Python models on Snowflake via Snowpark for the Coalesce 2022 conference. It will not be actively maintained. See the repository it was forked from for a current version -- we will work to merge the Python models into the main branch there after Coalesce.
What a cool DAG! Python and SQL side-by-side in dbt!
Python models in dbt Cloud!
Follow these instructions to run yourself.
If you're running in dbt Cloud, ensure your environment(s) that need to run Python models are on v1.3+.
To run locally, you need to update dbt-core and dbt-snowflake to 1.3 or later. We recommend creating a fresh venv and pip installing the packages. The exact steps may vary by your platform, but as an example with an environment named dbt_py:
$ python3 -m venv dbt_py
$ source dbt_py/bin/activate
$ (dbt_py) pip install --upgrade dbt-core dbt-snowflake
$ (dbt_py) which python3You can run dbt --version to ensure you have v1.3 installed.
To deactivate:
$ (dbt_py) deactivate
$ which python3You may want to create an additional venv for locally running the Snowpark Python package. Instructions for setup are in Untitled.ipynb, preceding local prototypes for the Python models.
If you're a dbt Labs employee, you can skip this step -- the source data is already loaded into the Snowflake sandbox account.
Otherwise, run the snowflake.sql script through the Snowflake UI or locally via snowsql. This will create the ecommerce database and source tables from parquet files in S3. Modify the script as needed.
Run dbt deps.
Run individual models or build the entire project!
$ (dbt_py) dbt run -s describe_py
$ (dbt_py) dbt buildAnd generate the docs!
$ (dbt_py) dbt docs generate && dbt docs serveSee the challenges directory's README.md.
We'd welcome contributions to this demo project. However, we will likely archive this repository sometime after Coalesce 2022. Consider contributing to the repository this one is forked from instead!

