-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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: command to sync DBT to Superset #18098
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18098 +/- ##
==========================================
- Coverage 65.85% 65.73% -0.13%
==========================================
Files 1577 1581 +4
Lines 61828 61942 +114
Branches 6244 6244
==========================================
Hits 40719 40719
- Misses 19509 19623 +114
Partials 1600 1600
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Beto, are you aware of this project? Regarding your approach, I have some doubts on automatically updating the DB connection. |
Yes, it was the inspiration! I should've mentioned it in the summary, I'll update it. I think both approaches are valid — this one here is simpler because you're using the CLI, while the other uses the API and is valuable for cases where you don't have direct access.
That's a great point! I'll make it optional, allowing the user to reuse an existing DB. |
Sounds great. BTW, I am not associated with the dbt-superset-lineage project in any way. I was just planning to give it a try in the near future. However, now I am curious to wait for your solution. |
@rumbin Being at least somewhat associated with it, although not one of the authors, please do not hesitate to reach out with feedback! |
To run it in CI/CD you would need to |
Based on a conversation in the dbt Slack #tools-superset channel It was suggested that I add a comment to this PR.
The above would create datasets for all the models in under marts |
I'm working on a better solution for this. |
@betodealmeida Is there any resource for your new approach available? |
@rumbin take a look at https://github.com/preset-io/backend-sdk |
Really interested in any work to make DBT and Superset work better together. |
SUMMARY
This PR introduces a new command to sync metadata from DBT to Superset. The command reads the profile and manifest files, creating/updating databases and datasets in Superset based on them.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Given this
~/.dbt/profiles.yml
:The file
messages_channels.sql
:And
schema.yaml
:We can run:
This will (1) create (or update) the a new database connection based on Postgres:
It will also (2) create/update three datasets owner by the admin:
(Note that the dataset description comes from the DBT config.)
It will also populate metrics:
TESTING INSTRUCTIONS
superset sync dbt /path/to/project/target/manifest.json --project PROJECT --target TARGET
Check that everything is imported correctly.
Currently, this only works for Postgres, but adding other profile types is straightforward.
ADDITIONAL INFORMATION