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

feat: Add command to generate a dbt exposures file #851

Merged
merged 3 commits into from
Jun 17, 2024
Merged

Conversation

bmtcril
Copy link
Contributor

@bmtcril bmtcril commented Jun 12, 2024

We'll use this in aspects-dbt CI to keep the model to dashboard mappings up to date. Leaving this in draft for the moment so we can discuss the direction. The idea is to have this command to generate an exposures file that we can bring back to aspects-dbt.

This should allow us visibility into which datasets are actually being used (or not used) in Superset and let us remove unused models. However there's a dependency problem where tutor-contrib-aspects needs to update to use a new aspects-dbt and there may be error-causing issues generating the exposures until it is updated. I haven't given much thought to how to resolve that yet, but we could move the dbt docs to that repo instead and use the combined official tutor-contrib-aspects / aspects-dbt version to make the file / docs.

@bmtcril bmtcril force-pushed the bmtcril/dbt_lineage branch from d61ed0d to 553c1b5 Compare June 12, 2024 17:38
@bmtcril
Copy link
Contributor Author

bmtcril commented Jun 12, 2024

Exposures file looks like this:

Screenshot 2024-06-12 at 3 43 29 PM

@bmtcril
Copy link
Contributor Author

bmtcril commented Jun 12, 2024

Exposure in the docs looks like this:

Screenshot 2024-06-12 at 3 46 38 PM

(If we fill in the dashboard descriptions in Superset they will propagate to the description there)

And lineage works:
Screenshot 2024-06-12 at 3 48 09 PM

@@ -76,6 +76,8 @@ jobs:
tutor local do dump-data-to-clickhouse --options "--object course_overviews"
make extract_translations
tutor local do import-assets
tutor local do collect-dbt-lineage
tutor local run lms python manage.py lms transform_tracking_logs --source_provider LOCAL --source_config '{"key": "/openedx/data/", "prefix": "tracking.log", "container": "logs"}' --destination_provider LRS --transformer_type xapi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a somewhat random addition to this PR, but will test that we don't break the backfill command again

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 Works great for me, thank you @bmtcril !

  • I tested this on my tutor dev aspects stack, and (after rebuilding the aspects-superset image) the command ran without issue.
  • I read through the code
  • I checked for accessibility issues N/A
  • Includes documentation
  • User-facing strings are extracted for translation N/A

@bmtcril bmtcril marked this pull request as ready for review June 14, 2024 12:26
@Ian2012
Copy link
Contributor

Ian2012 commented Jun 14, 2024

@bmtcril should we move this to aspects-dbt CI? Looks good to me, just it makes sense to have this exposed on the official DBT docs

@bmtcril
Copy link
Contributor Author

bmtcril commented Jun 14, 2024

@Ian2012 The problem with putting this in aspects-dbt CI is that the exposures will be out of date and cause errors building the docs if tutor-contrib-aspects hasn't been updated to use them yet. If we do it in this repo we can get the correct versions of aspects-dbt & Superset dashboards.

@bmtcril bmtcril force-pushed the bmtcril/dbt_lineage branch from 553c1b5 to 1a98712 Compare June 14, 2024 18:07
@@ -8,6 +8,8 @@ image: {{ DOCKER_IMAGE_SUPERSET }}
- ../../env/plugins/aspects/apps/superset/scripts:/app/scripts
- ../../env/plugins/aspects/build/aspects-superset/localization:/app/localization
- ../../env/plugins/aspects/build/aspects-superset/openedx-assets:/app/openedx-assets
# Shared with Aspects job so it has access to the state file for the lineage push job
- ../../data/aspects-dbt:/app/dbt_manifest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ian2012 I'm pondering how to make this work with k8s based on our earlier discussion

@bmtcril
Copy link
Contributor Author

bmtcril commented Jun 17, 2024

We're going to punt on k8s support for this temporarily and merge it as-is. Eventually we'd like to make the dbt docs using whatever the installed (potentially custom) version of dbt is and exposures from all (potentially custom) dashboards available in the Tutor environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants