Skip to content

Commit

Permalink
Last few test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Nov 3, 2021
1 parent aa0819f commit 9d9cfaf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
{%- endmacro %}

{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}
{%- set sql_header = config.get('sql_header', none) -%}

{{ sql_header if sql_header is not none }}

create {% if temporary: -%}temporary{%- endif %} table
{{ relation.include(database=(not temporary), schema=(not temporary)) }}
as (
{{ sql }}
);

{{ return(create_table_as(temporary, relation, sql)) }}
{% endmacro %}


/* {# old name for backwards compatibility #} */
/* {# keep logic under old macro name for backwards compatibility #} */
{% macro create_table_as(temporary, relation, sql) -%}
{{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}
{%- endmacro %}

{% macro default__create_table_as(temporary, relation, sql) -%}
{{ return(get_create_table_as_sql(temporary, relation, sql)) }}
{%- set sql_header = config.get('sql_header', none) -%}

{{ sql_header if sql_header is not none }}

create {% if temporary: -%}temporary{%- endif %} table
{{ relation.include(database=(not temporary), schema=(not temporary)) }}
as (
{{ sql }}
);
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
{%- endmacro %}

{% macro default__get_create_view_as_sql(relation, sql) -%}
{%- set sql_header = config.get('sql_header', none) -%}

{{ sql_header if sql_header is not none }}
create view {{ relation }} as (
{{ sql }}
);
{{ return(create_view_as(relation, sql)) }}
{% endmacro %}


/* {# old name for backwards compatibility #} */
/* {# keep logic under old name for backwards compatibility #} */
{% macro create_view_as(relation, sql) -%}
{{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}
{%- endmacro %}

{% macro default__create_view_as(relation, sql) -%}
{{ return(get_create_view_as_sql(relation, sql)) }}
{%- set sql_header = config.get('sql_header', none) -%}

{{ sql_header if sql_header is not none }}
create view {{ relation }} as (
{{ sql }}
);
{%- endmacro %}
10 changes: 5 additions & 5 deletions test/integration/029_docs_generate_tests/test_docs_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ def unrendered_tst_config(self, **updates):
def _verify_generic_macro_structure(self, manifest):
# just test a known global macro to avoid having to update this every
# time they change.
self.assertIn('macro.dbt.column_list', manifest['macros'])
macro = manifest['macros']['macro.dbt.column_list']
self.assertIn('macro.dbt.get_quoted_csv', manifest['macros'])
macro = manifest['macros']['macro.dbt.get_quoted_csv']
self.assertEqual(
set(macro),
{
Expand All @@ -574,7 +574,7 @@ def _verify_generic_macro_structure(self, manifest):
if k not in {'macro_sql'}
}
# Windows means we can't hard-code these.
helpers_path = Normalized('macros/materializations/incremental/column_helpers.sql')
helpers_path = Normalized('macros/materializations/models/incremental/column_helpers.sql')
root_path = Normalized(os.path.join(
self.dbt_core_install_root, 'include', 'global_project'
))
Expand All @@ -584,8 +584,8 @@ def _verify_generic_macro_structure(self, manifest):
'original_file_path': helpers_path,
'package_name': 'dbt',
'root_path': root_path,
'name': 'column_list',
'unique_id': 'macro.dbt.column_list',
'name': 'get_quoted_csv',
'unique_id': 'macro.dbt.get_quoted_csv',
'created_at': ANY,
'tags': [],
'resource_type': 'macro',
Expand Down

0 comments on commit 9d9cfaf

Please sign in to comment.