-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/hackathon model generator (#83)
* feature/hackathon-model-generator * documentation updates * final bash script changes * readme updates * changelog entry * Remove `columns_array` and `&&` and add some light commentary Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com> Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
- Loading branch information
1 parent
9249b66
commit 6da8a04
Showing
4 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
echo "" > models/stg_$1__$2.sql | ||
|
||
dbt run-operation codegen.generate_base_model --args '{"source_name": "'$1'", "table_name": "'$2'"}' | tail -n +3 >> models/stg_$1__$2.sql |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% macro create_base_models(source_name, tables) %} | ||
|
||
{% set source_name = ""~ source_name ~"" %} | ||
|
||
{% set zsh_command_models = "source dbt_packages/codegen/bash_scripts/base_model_creation.sh """~ source_name ~""" " %} | ||
|
||
{%- set models_array = [] -%} | ||
|
||
{% for t in tables %} | ||
{% set help_command = zsh_command_models + t %} | ||
{{ models_array.append(help_command) }} | ||
{% endfor %} | ||
|
||
{{ log("Run these commands in your shell to generate the models:\n" ~ models_array|join(' && \n'), info=True) }} | ||
|
||
{% endmacro %} |