Importing a Dagster project that includes a dbt project
Importing an existing dbt project in Dagster+ allows you to automatically load your dbt models as Dagster assets. In this guide, we'll demonstrate by using an existing Dagster project that includes a dbt project.
Prerequisites
To follow the steps in this guide, you'll need Dagster+ Organization Admin, Admin, or Editor permissions in order to create a code location.
Additionally, Dagster+ requires several files to be present in your project. To learn more about the structure and files required in a dbt and Dagster project, see "Creating a dbt project in a Dagster project".
Step 1: Import your project in Dagster+
In this section, we'll demonstrate how to import an existing project to Dagster+. Our example imports the project from a GitHub repository, but Dagster+ also supports GitLab.
-
Sign in to your Dagster+ account.
-
Navigate to Deployment > Code locations.
-
Click Add code location.
-
Click Import a Dagster project.
-
At this point, you'll be prompted to select either GitHub or GitLab. For this guide, we'll select GitHub.
-
If prompted, sign into your GitHub account and complete the authorization process for the Dagster+ application. Note: The profile or organization you're using to authorize Dagster+ must have read and write access to the repository containing the project. After the authorization is complete, you'll be redirected back to Dagster+.
-
In Dagster+, locate and select the repository containing the project by using the dropdowns. Note: dbt projects must have
dbt_profiles.ymlandprofiles.ymlfiles in the repository root or an error will display. -
Click Continue to begin the import process. Dagster+ will directly commit the files to the repository.
Step 2: Review the repository changes
The file structure of the repository will change the first time a project is deployed using Dagster+. For dbt projects, a .yml workflow file, used for CI/CD, will be created in .github/workflows. This file, named dagster-plus-deploy.yml, manages the deployments of the repository.
How the repository will change after the project is deployed for the first time
After the Dagster+ changes, a dbt and Dagster project will include the files required for dbt and Dagster, some files related to git, and the newly-added Dagster+ files:
## dbt and Dagster project
## after Dagster+ deployment
my_dbt_and_dagster_project
├── .github ## CI/CD files
│ ├── workflows
│ │ ├── dagster-plus-deploy.yml
├── dbt
│ ├── models
│ │ ├── my_model.sql
│ ├── seeds
│ │ ├── my_seeds.csv
│ ├── dbt_project.yml