-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from randypitcherii/2021-03-25--better_codegen
made codegen database-level
- Loading branch information
Showing
2 changed files
with
20 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{# | ||
Run the following dbt command: | ||
|
||
dbt run-operation generate_source_yml_for_database --args '{db: my_db, generate_cols: True}' | ||
|
||
Then, copy the output into your source.yml file! | ||
#} | ||
|
||
{% macro generate_source_yml_for_database(db='RAW', generate_cols=True) %} | ||
|
||
{# Get schemas (technically, schemata is the plural of schema - but I am a rebel) #} | ||
{% set schemas = run_query("select schema_name from " ~ db ~ ".information_schema.schemata where schema_name != 'INFORMATION_SCHEMA'").columns[0].values() %} | ||
|
||
{# Generate source yaml for each database. There are duplicate version entries for now but I would like to fix this in the future. For now, just buck up and clean the text by hand #} | ||
{% for schema in schemas %} | ||
{{ codegen.generate_source(schema_name=schema, database_name=db, generate_columns=generate_cols) }} | ||
{% do log('\n---\n\n', true) %} | ||
{% endfor %} | ||
|
||
{% endmacro %} |
This file was deleted.
Oops, something went wrong.