-
Notifications
You must be signed in to change notification settings - Fork 5
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
Draft: dbt dag generator - Experimental #15
Draft
MeltyBot
wants to merge
16
commits into
main
Choose a base branch
from
dbt_dag_generator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Migrated from GitLab: https://gitlab.com/meltano/files-airflow/-/merge_requests/8
Originally created by @pnadolny13 on 2022-03-04 20:00:16
I demoed this in https://www.youtube.com/watch?v=pNGJ96HOioM and theres a working sample of it in https://github.com/pnadolny13/meltano_example_implementations.
Airflow DAGs created by dbt manifest.json dependencies where each dbt model is a task in Airflow and dbt sources are assumed to be fed by a Meltano elt sync job with the same tap name (i.e. dbt source tap_gitlab translates to
meltano elt tap-gitlab target-x
)dag_definition.yml
file is where selections are defined. The structure is open to being changed but right now it looks like:The generator runs the selection rule using
meltano invoke dbt ls --select {selection_rule}
to generate a list of models and sources to consider. Then it loops through the manifest.json and builds the Airflow DAG based on only the models in the list generated by thels
command.I chose to split the generator logic out to separate classes so we can have many generator options, one of which uses dbt. If we put all the logic into the generator class then they can be swapped in/out or multiple called based on the definition yaml file. In this case we have a dbt generator and a meltano generator (using
schedules
).Challenges/Assumptions:
dags.generator_configs.dbt.soure_tap_mapping
which would override the default mapping between a source name and the tap that it references. If stream maps are used to alias streams, like "commits" to "gitlab_commits" and the dbt model is named "gitlab_commits". You will need to map these explicitly.dags.generator_configs.dbt.default_target
dags.generator_configs.dbt.stream_level
which sets whether to run the full tap sync or try to run a stream level sync based on the source name. If they arent working quite right at the stream level you can easily just turn that off and let the bookmarking handle running a sync many times.Decisions:
Now the user is required to run the
generator_cache_builder.py
to build the cache, I imagine this will be done in CI as a build artifact.Also check out the readme for more details.