Skip to content

Commit

Permalink
Better _is_relation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Apr 30, 2019
1 parent 0ce0b44 commit 358f94d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions macros/cross_db_utils/_is_relation.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro _is_relation(arg, macro) %}
{%- if execute and arg.name is none -%}
{%- do exceptions.raise_compiler_error("Macro " ~ macro ~ " expected a Relation but received the value: " ~ arg) -%}
{% macro _is_relation(obj, macro) %}
{%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}
{%- do exceptions.raise_compiler_error("Macro " ~ macro ~ " expected a Relation but received the value: " ~ obj) -%}
{%- endif -%}
{% endmacro %}
2 changes: 1 addition & 1 deletion macros/sql/get_tables_by_prefix_sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

select distinct
table_schema as "table_schema", table_name as "table_name"
from {{adapter.quote(database)}}.information_schema.tables
from {{database}}.information_schema.tables
where table_schema = '{{ schema }}'
and table_name ilike '{{ prefix }}%'
and table_name not ilike '{{ exclude }}'
Expand Down

0 comments on commit 358f94d

Please sign in to comment.