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

Use get relations by pattern #42

Merged
merged 2 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dbt-codegen v0.4.0 (unreleased)

## Fixes
- In the `generate_source` macro, use `dbt_utils.get_relations_by_pattern` instead of `get_relations_by_prefix`, since the latter will be deprecated in the future (#42)

## Features

Expand Down
17 changes: 7 additions & 10 deletions macros/generate_source.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{% macro get_tables_in_schema(schema_name,database_name=target.database) %}
{% macro get_tables_in_schema(schema_name, database_name=target.database) %}

{% set tables=dbt_utils.get_relations_by_prefix(
schema=schema_name,
prefix='',
database=database_name
)
%}
{% set tables=dbt_utils.get_relations_by_pattern(
database=database_name,
schema_pattern=schema_name,
table_pattern='%'
) %}

{% set table_list= tables | map(attribute = 'identifier') %}
{% set table_list= tables | map(attribute='identifier') %}

{{ return(table_list | sort) }}
{{ log("*** table list ***", info=True) }}
{{ log(table_list, info=True) }}

{% endmacro %}

Expand Down