Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[daggy-u][dbt] Update dbt course to use DbtProject #23098

Merged

Conversation

maximearmstrong
Copy link
Contributor

@maximearmstrong maximearmstrong commented Jul 18, 2024

Summary & Motivation

This PR updates the dbt course in Dagster University to use DbtProject.

To do outside this PR:

  • update the knowledge check/quiz in Lesson 4. The DAGSTER_DBT_PARSE_PROJECT_ON_LOAD env var is no longer used.

How I Tested These Changes

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @maximearmstrong and the rest of your teammates on Graphite Graphite

Copy link

github-actions bot commented Jul 18, 2024

Deploy preview for dagster-university ready!

✅ Preview
https://dagster-university-4o24647sg-elementl.vercel.app
https://maxime-ds-336-update-dbt-course-to-use-dbtproject.dagster-university.dagster-docs.io

Built with commit 66dd24f.
This pull request is being automatically deployed with vercel-action

@maximearmstrong maximearmstrong self-assigned this Jul 24, 2024
@maximearmstrong maximearmstrong force-pushed the maxime/ds-336/update-dbt-course-to-use-dbtproject branch from 68dbc27 to 07b7ca3 Compare July 24, 2024 23:00
@maximearmstrong maximearmstrong marked this pull request as ready for review July 24, 2024 23:03
@graphite-app graphite-app bot added the area: dagster-university Related to Dagster University label Jul 24, 2024
@graphite-app graphite-app bot requested a review from erinkcochran87 July 24, 2024 23:03
@maximearmstrong maximearmstrong requested review from cmpadden, yuhan, PedramNavid and erinkcochran87 and removed request for erinkcochran87 July 24, 2024 23:03
@cmpadden
Copy link
Contributor

This is looking great.

@maximearmstrong we will also need to update the "completed" dagster-and-dbt project here:


```python
dbt_project = DbtProject(
project_dir=Path(__file__).joinpath("..", "..", "..", "analytics").resolve(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we did this in the previous lesson as well, but I'm not a fan of repeating .. relative paths.

Would it be more intuitive if we used dagster home, or DagsterInstance.get().root_directory()? This can merge before this change, but wanted to bring it up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your point, but I think we should avoid this for two main reasons:

  • it is common to see a dbt project outside the Dagster project directory - we would need to resolve the path using DagsterInstance.get().root_directory() and more .. to indicate the dbt project location.
  • the current scaffold template uses .. relative paths. If we want to change that in Dagster University, we should start by the scaffold.

Copy link
Contributor

@erinkcochran87 erinkcochran87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! A few things, but overall it's looking good.

Let me know when this is ready to go and I'll update the quiz and lesson title in the LMS.


As you’ll frequently point your Dagster code to the `target/manifest.json` file and your dbt project in this course, it’ll be helpful to keep a reusable representation of the dbt project. This can be easily done using the `DbtProject` class.

Create a new file in the `assets` directory called `dbt.py`. Open that file and add the following import at the top:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Create a new file in the `assets` directory called `dbt.py`. Open that file and add the following import at the top:
In the `assets` directory, create a new `dbt.py` file and add the following imports:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I see now:

In the dagster_university directory, create a new project.py file and add the following imports:

But later on in the lesson, dbt.py is still used (ex: line 31).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch! Fixed in 66dd24f

@maximearmstrong maximearmstrong force-pushed the maxime/ds-336/update-dbt-course-to-use-dbtproject branch from bf706a6 to 54fd52f Compare August 5, 2024 17:20
@maximearmstrong
Copy link
Contributor Author

Thanks for doing this! A few things, but overall it's looking good.

@erinkcochran87 All comments were addressed in 54fd52f

Let me know when this is ready to go and I'll update the quiz and lesson title in the LMS.

Perfect. We need to update the final example then we are ready to go. Will let you know!

@maximearmstrong maximearmstrong force-pushed the maxime/ds-336/update-dbt-course-to-use-dbtproject branch from 54fd52f to 305f9ff Compare August 5, 2024 20:31
@maximearmstrong
Copy link
Contributor Author

After fully testing the updated final example here, I've updated this PR in commit 305f9ff.

tl;dr: the DbtProject object should be on a file on its own to avoid import issues during development when calling dagster-dbt project prepare-and-package.

cc @cmpadden @erinkcochran87 if you want to review the changes in this commit before we merge.

Copy link
Contributor

@erinkcochran87 erinkcochran87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back to you!

@maximearmstrong maximearmstrong merged commit b6156a4 into master Aug 7, 2024
2 checks passed
@maximearmstrong maximearmstrong deleted the maxime/ds-336/update-dbt-course-to-use-dbtproject branch August 7, 2024 01:56
PedramNavid pushed a commit that referenced this pull request Aug 7, 2024
## Summary & Motivation

This PR updates the dbt course in Dagster University to use DbtProject.

To do outside this PR:
- update the knowledge check/quiz in Lesson 4. The
`DAGSTER_DBT_PARSE_PROJECT_ON_LOAD` env var is no longer used.

## How I Tested These Changes
jmsanders pushed a commit that referenced this pull request Aug 7, 2024
## Summary & Motivation

This PR updates the dbt course in Dagster University to use DbtProject.

To do outside this PR:
- update the knowledge check/quiz in Lesson 4. The
`DAGSTER_DBT_PARSE_PROJECT_ON_LOAD` env var is no longer used.

## How I Tested These Changes

(cherry picked from commit b6156a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dagster-university Related to Dagster University
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants