dbt-adapters 0.1.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dbt-adapters might be problematic. Click here for more details.
- dbt/__init__.py +0 -0
- dbt/adapters/__about__.py +1 -0
- dbt/adapters/__init__.py +7 -0
- dbt/adapters/base/README.md +13 -0
- dbt/adapters/base/__init__.py +15 -0
- dbt/adapters/base/column.py +166 -0
- dbt/adapters/base/connections.py +426 -0
- dbt/adapters/base/impl.py +1654 -0
- dbt/adapters/base/meta.py +131 -0
- dbt/adapters/base/plugin.py +32 -0
- dbt/adapters/base/query_headers.py +101 -0
- dbt/adapters/base/relation.py +471 -0
- dbt/adapters/cache.py +521 -0
- dbt/adapters/capability.py +52 -0
- dbt/adapters/clients/__init__.py +0 -0
- dbt/adapters/clients/jinja.py +24 -0
- dbt/adapters/contracts/__init__.py +0 -0
- dbt/adapters/contracts/connection.py +228 -0
- dbt/adapters/contracts/macros.py +11 -0
- dbt/adapters/contracts/relation.py +125 -0
- dbt/adapters/events/README.md +57 -0
- dbt/adapters/events/__init__.py +0 -0
- dbt/adapters/events/adapter_types.proto +517 -0
- dbt/adapters/events/adapter_types_pb2.py +208 -0
- dbt/adapters/events/base_types.py +40 -0
- dbt/adapters/events/logging.py +83 -0
- dbt/adapters/events/types.py +423 -0
- dbt/adapters/exceptions/__init__.py +40 -0
- dbt/adapters/exceptions/alias.py +24 -0
- dbt/adapters/exceptions/cache.py +68 -0
- dbt/adapters/exceptions/compilation.py +255 -0
- dbt/adapters/exceptions/connection.py +16 -0
- dbt/adapters/exceptions/database.py +51 -0
- dbt/adapters/factory.py +246 -0
- dbt/adapters/protocol.py +173 -0
- dbt/adapters/reference_keys.py +39 -0
- dbt/adapters/relation_configs/README.md +25 -0
- dbt/adapters/relation_configs/__init__.py +12 -0
- dbt/adapters/relation_configs/config_base.py +44 -0
- dbt/adapters/relation_configs/config_change.py +24 -0
- dbt/adapters/relation_configs/config_validation.py +57 -0
- dbt/adapters/sql/__init__.py +2 -0
- dbt/adapters/sql/connections.py +195 -0
- dbt/adapters/sql/impl.py +273 -0
- dbt/adapters/utils.py +69 -0
- dbt/include/global_project/__init__.py +4 -0
- dbt/include/global_project/dbt_project.yml +7 -0
- dbt/include/global_project/docs/overview.md +43 -0
- dbt/include/global_project/macros/adapters/apply_grants.sql +167 -0
- dbt/include/global_project/macros/adapters/columns.sql +137 -0
- dbt/include/global_project/macros/adapters/freshness.sql +16 -0
- dbt/include/global_project/macros/adapters/indexes.sql +41 -0
- dbt/include/global_project/macros/adapters/metadata.sql +96 -0
- dbt/include/global_project/macros/adapters/persist_docs.sql +33 -0
- dbt/include/global_project/macros/adapters/relation.sql +79 -0
- dbt/include/global_project/macros/adapters/schema.sql +20 -0
- dbt/include/global_project/macros/adapters/show.sql +22 -0
- dbt/include/global_project/macros/adapters/timestamps.sql +44 -0
- dbt/include/global_project/macros/adapters/validate_sql.sql +10 -0
- dbt/include/global_project/macros/etc/datetime.sql +62 -0
- dbt/include/global_project/macros/etc/statement.sql +52 -0
- dbt/include/global_project/macros/generic_test_sql/accepted_values.sql +27 -0
- dbt/include/global_project/macros/generic_test_sql/not_null.sql +9 -0
- dbt/include/global_project/macros/generic_test_sql/relationships.sql +23 -0
- dbt/include/global_project/macros/generic_test_sql/unique.sql +12 -0
- dbt/include/global_project/macros/get_custom_name/get_custom_alias.sql +36 -0
- dbt/include/global_project/macros/get_custom_name/get_custom_database.sql +32 -0
- dbt/include/global_project/macros/get_custom_name/get_custom_schema.sql +60 -0
- dbt/include/global_project/macros/materializations/configs.sql +21 -0
- dbt/include/global_project/macros/materializations/hooks.sql +35 -0
- dbt/include/global_project/macros/materializations/models/clone/can_clone_table.sql +7 -0
- dbt/include/global_project/macros/materializations/models/clone/clone.sql +67 -0
- dbt/include/global_project/macros/materializations/models/clone/create_or_replace_clone.sql +7 -0
- dbt/include/global_project/macros/materializations/models/incremental/column_helpers.sql +80 -0
- dbt/include/global_project/macros/materializations/models/incremental/incremental.sql +92 -0
- dbt/include/global_project/macros/materializations/models/incremental/is_incremental.sql +13 -0
- dbt/include/global_project/macros/materializations/models/incremental/merge.sql +131 -0
- dbt/include/global_project/macros/materializations/models/incremental/on_schema_change.sql +144 -0
- dbt/include/global_project/macros/materializations/models/incremental/strategies.sql +79 -0
- dbt/include/global_project/macros/materializations/models/materialized_view.sql +121 -0
- dbt/include/global_project/macros/materializations/models/table.sql +64 -0
- dbt/include/global_project/macros/materializations/models/view.sql +72 -0
- dbt/include/global_project/macros/materializations/seeds/helpers.sql +128 -0
- dbt/include/global_project/macros/materializations/seeds/seed.sql +60 -0
- dbt/include/global_project/macros/materializations/snapshots/helpers.sql +181 -0
- dbt/include/global_project/macros/materializations/snapshots/snapshot.sql +99 -0
- dbt/include/global_project/macros/materializations/snapshots/snapshot_merge.sql +25 -0
- dbt/include/global_project/macros/materializations/snapshots/strategies.sql +174 -0
- dbt/include/global_project/macros/materializations/tests/helpers.sql +14 -0
- dbt/include/global_project/macros/materializations/tests/test.sql +60 -0
- dbt/include/global_project/macros/materializations/tests/where_subquery.sql +15 -0
- dbt/include/global_project/macros/python_model/python.sql +103 -0
- dbt/include/global_project/macros/relations/column/columns_spec_ddl.sql +89 -0
- dbt/include/global_project/macros/relations/create.sql +23 -0
- dbt/include/global_project/macros/relations/create_backup.sql +17 -0
- dbt/include/global_project/macros/relations/create_intermediate.sql +17 -0
- dbt/include/global_project/macros/relations/drop.sql +41 -0
- dbt/include/global_project/macros/relations/drop_backup.sql +14 -0
- dbt/include/global_project/macros/relations/materialized_view/alter.sql +55 -0
- dbt/include/global_project/macros/relations/materialized_view/create.sql +10 -0
- dbt/include/global_project/macros/relations/materialized_view/drop.sql +14 -0
- dbt/include/global_project/macros/relations/materialized_view/refresh.sql +9 -0
- dbt/include/global_project/macros/relations/materialized_view/rename.sql +10 -0
- dbt/include/global_project/macros/relations/materialized_view/replace.sql +10 -0
- dbt/include/global_project/macros/relations/rename.sql +35 -0
- dbt/include/global_project/macros/relations/rename_intermediate.sql +14 -0
- dbt/include/global_project/macros/relations/replace.sql +50 -0
- dbt/include/global_project/macros/relations/schema.sql +8 -0
- dbt/include/global_project/macros/relations/table/create.sql +60 -0
- dbt/include/global_project/macros/relations/table/drop.sql +14 -0
- dbt/include/global_project/macros/relations/table/rename.sql +10 -0
- dbt/include/global_project/macros/relations/table/replace.sql +10 -0
- dbt/include/global_project/macros/relations/view/create.sql +27 -0
- dbt/include/global_project/macros/relations/view/drop.sql +14 -0
- dbt/include/global_project/macros/relations/view/rename.sql +10 -0
- dbt/include/global_project/macros/relations/view/replace.sql +66 -0
- dbt/include/global_project/macros/utils/any_value.sql +9 -0
- dbt/include/global_project/macros/utils/array_append.sql +8 -0
- dbt/include/global_project/macros/utils/array_concat.sql +7 -0
- dbt/include/global_project/macros/utils/array_construct.sql +12 -0
- dbt/include/global_project/macros/utils/bool_or.sql +9 -0
- dbt/include/global_project/macros/utils/cast_bool_to_text.sql +7 -0
- dbt/include/global_project/macros/utils/concat.sql +7 -0
- dbt/include/global_project/macros/utils/data_types.sql +129 -0
- dbt/include/global_project/macros/utils/date_spine.sql +75 -0
- dbt/include/global_project/macros/utils/date_trunc.sql +7 -0
- dbt/include/global_project/macros/utils/dateadd.sql +14 -0
- dbt/include/global_project/macros/utils/datediff.sql +14 -0
- dbt/include/global_project/macros/utils/escape_single_quotes.sql +8 -0
- dbt/include/global_project/macros/utils/except.sql +9 -0
- dbt/include/global_project/macros/utils/generate_series.sql +53 -0
- dbt/include/global_project/macros/utils/hash.sql +7 -0
- dbt/include/global_project/macros/utils/intersect.sql +9 -0
- dbt/include/global_project/macros/utils/last_day.sql +15 -0
- dbt/include/global_project/macros/utils/length.sql +11 -0
- dbt/include/global_project/macros/utils/listagg.sql +30 -0
- dbt/include/global_project/macros/utils/literal.sql +7 -0
- dbt/include/global_project/macros/utils/position.sql +11 -0
- dbt/include/global_project/macros/utils/replace.sql +14 -0
- dbt/include/global_project/macros/utils/right.sql +12 -0
- dbt/include/global_project/macros/utils/safe_cast.sql +9 -0
- dbt/include/global_project/macros/utils/split_part.sql +26 -0
- dbt/include/global_project/tests/generic/builtin.sql +30 -0
- dbt_adapters-0.1.0a1.dist-info/METADATA +81 -0
- dbt_adapters-0.1.0a1.dist-info/RECORD +147 -0
- dbt_adapters-0.1.0a1.dist-info/WHEEL +4 -0
- dbt_adapters-0.1.0a1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{%- macro get_table_columns_and_constraints() -%}
|
|
2
|
+
{{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}
|
|
3
|
+
{%- endmacro -%}
|
|
4
|
+
|
|
5
|
+
{% macro default__get_table_columns_and_constraints() -%}
|
|
6
|
+
{{ return(table_columns_and_constraints()) }}
|
|
7
|
+
{%- endmacro %}
|
|
8
|
+
|
|
9
|
+
{% macro table_columns_and_constraints() %}
|
|
10
|
+
{# loop through user_provided_columns to create DDL with data types and constraints #}
|
|
11
|
+
{%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}
|
|
12
|
+
{%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}
|
|
13
|
+
(
|
|
14
|
+
{% for c in raw_column_constraints -%}
|
|
15
|
+
{{ c }}{{ "," if not loop.last or raw_model_constraints }}
|
|
16
|
+
{% endfor %}
|
|
17
|
+
{% for c in raw_model_constraints -%}
|
|
18
|
+
{{ c }}{{ "," if not loop.last }}
|
|
19
|
+
{% endfor -%}
|
|
20
|
+
)
|
|
21
|
+
{% endmacro %}
|
|
22
|
+
|
|
23
|
+
{%- macro get_assert_columns_equivalent(sql) -%}
|
|
24
|
+
{{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}
|
|
25
|
+
{%- endmacro -%}
|
|
26
|
+
|
|
27
|
+
{% macro default__get_assert_columns_equivalent(sql) -%}
|
|
28
|
+
{{ return(assert_columns_equivalent(sql)) }}
|
|
29
|
+
{%- endmacro %}
|
|
30
|
+
|
|
31
|
+
{#
|
|
32
|
+
Compares the column schema provided by a model's sql file to the column schema provided by a model's schema file.
|
|
33
|
+
If any differences in name, data_type or number of columns exist between the two schemas, raises a compiler error
|
|
34
|
+
#}
|
|
35
|
+
{% macro assert_columns_equivalent(sql) %}
|
|
36
|
+
|
|
37
|
+
{#-- First ensure the user has defined 'columns' in yaml specification --#}
|
|
38
|
+
{%- set user_defined_columns = model['columns'] -%}
|
|
39
|
+
{%- if not user_defined_columns -%}
|
|
40
|
+
{{ exceptions.raise_contract_error([], []) }}
|
|
41
|
+
{%- endif -%}
|
|
42
|
+
|
|
43
|
+
{#-- Obtain the column schema provided by sql file. #}
|
|
44
|
+
{%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}
|
|
45
|
+
{#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}
|
|
46
|
+
{%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}
|
|
47
|
+
|
|
48
|
+
{#-- create dictionaries with name and formatted data type and strings for exception #}
|
|
49
|
+
{%- set sql_columns = format_columns(sql_file_provided_columns) -%}
|
|
50
|
+
{%- set yaml_columns = format_columns(schema_file_provided_columns) -%}
|
|
51
|
+
|
|
52
|
+
{%- if sql_columns|length != yaml_columns|length -%}
|
|
53
|
+
{%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}
|
|
54
|
+
{%- endif -%}
|
|
55
|
+
|
|
56
|
+
{%- for sql_col in sql_columns -%}
|
|
57
|
+
{%- set yaml_col = [] -%}
|
|
58
|
+
{%- for this_col in yaml_columns -%}
|
|
59
|
+
{%- if this_col['name'] == sql_col['name'] -%}
|
|
60
|
+
{%- do yaml_col.append(this_col) -%}
|
|
61
|
+
{%- break -%}
|
|
62
|
+
{%- endif -%}
|
|
63
|
+
{%- endfor -%}
|
|
64
|
+
{%- if not yaml_col -%}
|
|
65
|
+
{#-- Column with name not found in yaml #}
|
|
66
|
+
{%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}
|
|
67
|
+
{%- endif -%}
|
|
68
|
+
{%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}
|
|
69
|
+
{#-- Column data types don't match #}
|
|
70
|
+
{%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}
|
|
71
|
+
{%- endif -%}
|
|
72
|
+
{%- endfor -%}
|
|
73
|
+
|
|
74
|
+
{% endmacro %}
|
|
75
|
+
|
|
76
|
+
{% macro format_columns(columns) %}
|
|
77
|
+
{% set formatted_columns = [] %}
|
|
78
|
+
{% for column in columns %}
|
|
79
|
+
{%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}
|
|
80
|
+
{%- do formatted_columns.append(formatted_column) -%}
|
|
81
|
+
{% endfor %}
|
|
82
|
+
{{ return(formatted_columns) }}
|
|
83
|
+
{% endmacro %}
|
|
84
|
+
|
|
85
|
+
{% macro default__format_column(column) -%}
|
|
86
|
+
{% set data_type = column.dtype %}
|
|
87
|
+
{% set formatted = column.column.lower() ~ " " ~ data_type %}
|
|
88
|
+
{{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}
|
|
89
|
+
{%- endmacro -%}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{%- macro get_create_sql(relation, sql) -%}
|
|
2
|
+
{{- log('Applying CREATE to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_create_sql(relation, sql) -%}
|
|
8
|
+
|
|
9
|
+
{%- if relation.is_view -%}
|
|
10
|
+
{{ get_create_view_as_sql(relation, sql) }}
|
|
11
|
+
|
|
12
|
+
{%- elif relation.is_table -%}
|
|
13
|
+
{{ get_create_table_as_sql(False, relation, sql) }}
|
|
14
|
+
|
|
15
|
+
{%- elif relation.is_materialized_view -%}
|
|
16
|
+
{{ get_create_materialized_view_as_sql(relation, sql) }}
|
|
17
|
+
|
|
18
|
+
{%- else -%}
|
|
19
|
+
{{- exceptions.raise_compiler_error("`get_create_sql` has not been implemented for: " ~ relation.type ) -}}
|
|
20
|
+
|
|
21
|
+
{%- endif -%}
|
|
22
|
+
|
|
23
|
+
{%- endmacro -%}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{%- macro get_create_backup_sql(relation) -%}
|
|
2
|
+
{{- log('Applying CREATE BACKUP to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_create_backup_sql(relation) -%}
|
|
8
|
+
|
|
9
|
+
-- get the standard backup name
|
|
10
|
+
{% set backup_relation = make_backup_relation(relation, relation.type) %}
|
|
11
|
+
|
|
12
|
+
-- drop any pre-existing backup
|
|
13
|
+
{{ get_drop_sql(backup_relation) }};
|
|
14
|
+
|
|
15
|
+
{{ get_rename_sql(relation, backup_relation.identifier) }}
|
|
16
|
+
|
|
17
|
+
{%- endmacro -%}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{%- macro get_create_intermediate_sql(relation, sql) -%}
|
|
2
|
+
{{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_create_intermediate_sql(relation, sql) -%}
|
|
8
|
+
|
|
9
|
+
-- get the standard intermediate name
|
|
10
|
+
{% set intermediate_relation = make_intermediate_relation(relation) %}
|
|
11
|
+
|
|
12
|
+
-- drop any pre-existing intermediate
|
|
13
|
+
{{ get_drop_sql(intermediate_relation) }};
|
|
14
|
+
|
|
15
|
+
{{ get_create_sql(intermediate_relation, sql) }}
|
|
16
|
+
|
|
17
|
+
{%- endmacro -%}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{%- macro get_drop_sql(relation) -%}
|
|
2
|
+
{{- log('Applying DROP to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_drop_sql(relation) -%}
|
|
8
|
+
|
|
9
|
+
{%- if relation.is_view -%}
|
|
10
|
+
{{ drop_view(relation) }}
|
|
11
|
+
|
|
12
|
+
{%- elif relation.is_table -%}
|
|
13
|
+
{{ drop_table(relation) }}
|
|
14
|
+
|
|
15
|
+
{%- elif relation.is_materialized_view -%}
|
|
16
|
+
{{ drop_materialized_view(relation) }}
|
|
17
|
+
|
|
18
|
+
{%- else -%}
|
|
19
|
+
drop {{ relation.type }} if exists {{ relation }} cascade
|
|
20
|
+
|
|
21
|
+
{%- endif -%}
|
|
22
|
+
|
|
23
|
+
{%- endmacro -%}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
{% macro drop_relation(relation) -%}
|
|
27
|
+
{{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}
|
|
28
|
+
{% endmacro %}
|
|
29
|
+
|
|
30
|
+
{% macro default__drop_relation(relation) -%}
|
|
31
|
+
{% call statement('drop_relation', auto_begin=False) -%}
|
|
32
|
+
{{ get_drop_sql(relation) }}
|
|
33
|
+
{%- endcall %}
|
|
34
|
+
{% endmacro %}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
{% macro drop_relation_if_exists(relation) %}
|
|
38
|
+
{% if relation is not none %}
|
|
39
|
+
{{ adapter.drop_relation(relation) }}
|
|
40
|
+
{% endif %}
|
|
41
|
+
{% endmacro %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{%- macro get_drop_backup_sql(relation) -%}
|
|
2
|
+
{{- log('Applying DROP BACKUP to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_drop_backup_sql(relation) -%}
|
|
8
|
+
|
|
9
|
+
-- get the standard backup name
|
|
10
|
+
{% set backup_relation = make_backup_relation(relation, relation.type) %}
|
|
11
|
+
|
|
12
|
+
{{ get_drop_sql(backup_relation) }}
|
|
13
|
+
|
|
14
|
+
{%- endmacro -%}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{% macro get_alter_materialized_view_as_sql(
|
|
2
|
+
relation,
|
|
3
|
+
configuration_changes,
|
|
4
|
+
sql,
|
|
5
|
+
existing_relation,
|
|
6
|
+
backup_relation,
|
|
7
|
+
intermediate_relation
|
|
8
|
+
) %}
|
|
9
|
+
{{- log('Applying ALTER to: ' ~ relation) -}}
|
|
10
|
+
{{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(
|
|
11
|
+
relation,
|
|
12
|
+
configuration_changes,
|
|
13
|
+
sql,
|
|
14
|
+
existing_relation,
|
|
15
|
+
backup_relation,
|
|
16
|
+
intermediate_relation
|
|
17
|
+
) -}}
|
|
18
|
+
{% endmacro %}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
{% macro default__get_alter_materialized_view_as_sql(
|
|
22
|
+
relation,
|
|
23
|
+
configuration_changes,
|
|
24
|
+
sql,
|
|
25
|
+
existing_relation,
|
|
26
|
+
backup_relation,
|
|
27
|
+
intermediate_relation
|
|
28
|
+
) %}
|
|
29
|
+
{{ exceptions.raise_compiler_error("Materialized views have not been implemented for this adapter.") }}
|
|
30
|
+
{% endmacro %}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}
|
|
34
|
+
/* {#
|
|
35
|
+
It's recommended that configuration changes be formatted as follows:
|
|
36
|
+
{"<change_category>": [{"action": "<name>", "context": ...}]}
|
|
37
|
+
|
|
38
|
+
For example:
|
|
39
|
+
{
|
|
40
|
+
"indexes": [
|
|
41
|
+
{"action": "drop", "context": "index_abc"},
|
|
42
|
+
{"action": "create", "context": {"columns": ["column_1", "column_2"], "type": "hash", "unique": True}},
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.
|
|
47
|
+
#} */
|
|
48
|
+
{{- log('Determining configuration changes on: ' ~ existing_relation) -}}
|
|
49
|
+
{%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}
|
|
50
|
+
{% endmacro %}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}
|
|
54
|
+
{{ exceptions.raise_compiler_error("Materialized views have not been implemented for this adapter.") }}
|
|
55
|
+
{% endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% macro get_create_materialized_view_as_sql(relation, sql) -%}
|
|
2
|
+
{{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}
|
|
3
|
+
{%- endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_create_materialized_view_as_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{# /*
|
|
2
|
+
This was already implemented. Instead of creating a new macro that aligns with the standard,
|
|
3
|
+
this was reused and the default was maintained. This gets called by `drop_relation`, which
|
|
4
|
+
actually executes the drop, and `get_drop_sql`, which returns the template.
|
|
5
|
+
*/ #}
|
|
6
|
+
|
|
7
|
+
{% macro drop_materialized_view(relation) -%}
|
|
8
|
+
{{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}
|
|
9
|
+
{%- endmacro %}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
{% macro default__drop_materialized_view(relation) -%}
|
|
13
|
+
drop materialized view if exists {{ relation }} cascade
|
|
14
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{% macro refresh_materialized_view(relation) %}
|
|
2
|
+
{{- log('Applying REFRESH to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}
|
|
4
|
+
{% endmacro %}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{% macro default__refresh_materialized_view(relation) %}
|
|
8
|
+
{{ exceptions.raise_compiler_error("`refresh_materialized_view` has not been implemented for this adapter.") }}
|
|
9
|
+
{% endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% macro get_rename_materialized_view_sql(relation, new_name) %}
|
|
2
|
+
{{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_rename_materialized_view_sql(relation, new_name) %}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_rename_materialized_view_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% macro get_replace_materialized_view_sql(relation, sql) %}
|
|
2
|
+
{{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_replace_materialized_view_sql(relation, sql) %}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_replace_materialized_view_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{%- macro get_rename_sql(relation, new_name) -%}
|
|
2
|
+
{{- log('Applying RENAME to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_rename_sql(relation, new_name) -%}
|
|
8
|
+
|
|
9
|
+
{%- if relation.is_view -%}
|
|
10
|
+
{{ get_rename_view_sql(relation, new_name) }}
|
|
11
|
+
|
|
12
|
+
{%- elif relation.is_table -%}
|
|
13
|
+
{{ get_rename_table_sql(relation, new_name) }}
|
|
14
|
+
|
|
15
|
+
{%- elif relation.is_materialized_view -%}
|
|
16
|
+
{{ get_rename_materialized_view_sql(relation, new_name) }}
|
|
17
|
+
|
|
18
|
+
{%- else -%}
|
|
19
|
+
{{- exceptions.raise_compiler_error("`get_rename_sql` has not been implemented for: " ~ relation.type ) -}}
|
|
20
|
+
|
|
21
|
+
{%- endif -%}
|
|
22
|
+
|
|
23
|
+
{%- endmacro -%}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
{% macro rename_relation(from_relation, to_relation) -%}
|
|
27
|
+
{{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}
|
|
28
|
+
{% endmacro %}
|
|
29
|
+
|
|
30
|
+
{% macro default__rename_relation(from_relation, to_relation) -%}
|
|
31
|
+
{% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}
|
|
32
|
+
{% call statement('rename_relation') -%}
|
|
33
|
+
alter table {{ from_relation }} rename to {{ target_name }}
|
|
34
|
+
{%- endcall %}
|
|
35
|
+
{% endmacro %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{%- macro get_rename_intermediate_sql(relation) -%}
|
|
2
|
+
{{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}
|
|
4
|
+
{%- endmacro -%}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{%- macro default__get_rename_intermediate_sql(relation) -%}
|
|
8
|
+
|
|
9
|
+
-- get the standard intermediate name
|
|
10
|
+
{% set intermediate_relation = make_intermediate_relation(relation) %}
|
|
11
|
+
|
|
12
|
+
{{ get_rename_sql(intermediate_relation, relation.identifier) }}
|
|
13
|
+
|
|
14
|
+
{%- endmacro -%}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{% macro get_replace_sql(existing_relation, target_relation, sql) %}
|
|
2
|
+
{{- log('Applying REPLACE to: ' ~ existing_relation) -}}
|
|
3
|
+
{{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}
|
|
4
|
+
{% endmacro %}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}
|
|
8
|
+
|
|
9
|
+
{# /* use a create or replace statement if possible */ #}
|
|
10
|
+
|
|
11
|
+
{% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}
|
|
12
|
+
|
|
13
|
+
{% if is_replaceable and existing_relation.is_view %}
|
|
14
|
+
{{ get_replace_view_sql(target_relation, sql) }}
|
|
15
|
+
|
|
16
|
+
{% elif is_replaceable and existing_relation.is_table %}
|
|
17
|
+
{{ get_replace_table_sql(target_relation, sql) }}
|
|
18
|
+
|
|
19
|
+
{% elif is_replaceable and existing_relation.is_materialized_view %}
|
|
20
|
+
{{ get_replace_materialized_view_sql(target_relation, sql) }}
|
|
21
|
+
|
|
22
|
+
{# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}
|
|
23
|
+
|
|
24
|
+
{# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}
|
|
25
|
+
{%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}
|
|
26
|
+
{{ get_create_intermediate_sql(target_relation, sql) }};
|
|
27
|
+
{{ get_create_backup_sql(existing_relation) }};
|
|
28
|
+
{{ get_rename_intermediate_sql(target_relation) }};
|
|
29
|
+
{{ get_drop_backup_sql(existing_relation) }}
|
|
30
|
+
|
|
31
|
+
{# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}
|
|
32
|
+
{%- elif target_relation.can_be_renamed -%}
|
|
33
|
+
{{ get_create_intermediate_sql(target_relation, sql) }};
|
|
34
|
+
{{ get_drop_sql(existing_relation) }};
|
|
35
|
+
{{ get_rename_intermediate_sql(target_relation) }}
|
|
36
|
+
|
|
37
|
+
{# /* create target_relation in place by first backing up the existing relation */ #}
|
|
38
|
+
{%- elif existing_relation.can_be_renamed -%}
|
|
39
|
+
{{ get_create_backup_sql(existing_relation) }};
|
|
40
|
+
{{ get_create_sql(target_relation, sql) }};
|
|
41
|
+
{{ get_drop_backup_sql(existing_relation) }}
|
|
42
|
+
|
|
43
|
+
{# /* no renaming is allowed, so just drop and create */ #}
|
|
44
|
+
{%- else -%}
|
|
45
|
+
{{ get_drop_sql(existing_relation) }};
|
|
46
|
+
{{ get_create_sql(target_relation, sql) }}
|
|
47
|
+
|
|
48
|
+
{%- endif -%}
|
|
49
|
+
|
|
50
|
+
{% endmacro %}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{% macro drop_schema_named(schema_name) %}
|
|
2
|
+
{{ return(adapter.dispatch('drop_schema_named', 'dbt') (schema_name)) }}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
{% macro default__drop_schema_named(schema_name) %}
|
|
6
|
+
{% set schema_relation = api.Relation.create(schema=schema_name) %}
|
|
7
|
+
{{ adapter.drop_schema(schema_relation) }}
|
|
8
|
+
{% endmacro %}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{% macro get_create_table_as_sql(temporary, relation, sql) -%}
|
|
2
|
+
{{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}
|
|
3
|
+
{%- endmacro %}
|
|
4
|
+
|
|
5
|
+
{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}
|
|
6
|
+
{{ return(create_table_as(temporary, relation, sql)) }}
|
|
7
|
+
{% endmacro %}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/* {# keep logic under old macro name for backwards compatibility #} */
|
|
11
|
+
{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}
|
|
12
|
+
{# backward compatibility for create_table_as that does not support language #}
|
|
13
|
+
{% if language == "sql" %}
|
|
14
|
+
{{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}
|
|
15
|
+
{% else %}
|
|
16
|
+
{{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}
|
|
17
|
+
{% endif %}
|
|
18
|
+
|
|
19
|
+
{%- endmacro %}
|
|
20
|
+
|
|
21
|
+
{% macro default__create_table_as(temporary, relation, sql) -%}
|
|
22
|
+
{%- set sql_header = config.get('sql_header', none) -%}
|
|
23
|
+
|
|
24
|
+
{{ sql_header if sql_header is not none }}
|
|
25
|
+
|
|
26
|
+
create {% if temporary: -%}temporary{%- endif %} table
|
|
27
|
+
{{ relation.include(database=(not temporary), schema=(not temporary)) }}
|
|
28
|
+
{% set contract_config = config.get('contract') %}
|
|
29
|
+
{% if contract_config.enforced and (not temporary) %}
|
|
30
|
+
{{ get_assert_columns_equivalent(sql) }}
|
|
31
|
+
{{ get_table_columns_and_constraints() }}
|
|
32
|
+
{%- set sql = get_select_subquery(sql) %}
|
|
33
|
+
{% endif %}
|
|
34
|
+
as (
|
|
35
|
+
{{ sql }}
|
|
36
|
+
);
|
|
37
|
+
{%- endmacro %}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
{% macro default__get_column_names() %}
|
|
41
|
+
{#- loop through user_provided_columns to get column names -#}
|
|
42
|
+
{%- set user_provided_columns = model['columns'] -%}
|
|
43
|
+
{%- for i in user_provided_columns %}
|
|
44
|
+
{%- set col = user_provided_columns[i] -%}
|
|
45
|
+
{%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}
|
|
46
|
+
{{ col_name }}{{ ", " if not loop.last }}
|
|
47
|
+
{%- endfor -%}
|
|
48
|
+
{% endmacro %}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
{% macro get_select_subquery(sql) %}
|
|
52
|
+
{{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}
|
|
53
|
+
{% endmacro %}
|
|
54
|
+
|
|
55
|
+
{% macro default__get_select_subquery(sql) %}
|
|
56
|
+
select {{ adapter.dispatch('get_column_names', 'dbt')() }}
|
|
57
|
+
from (
|
|
58
|
+
{{ sql }}
|
|
59
|
+
) as model_subq
|
|
60
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{# /*
|
|
2
|
+
This was already implemented. Instead of creating a new macro that aligns with the standard,
|
|
3
|
+
this was reused and the default was maintained. This gets called by `drop_relation`, which
|
|
4
|
+
actually executes the drop, and `get_drop_sql`, which returns the template.
|
|
5
|
+
*/ #}
|
|
6
|
+
|
|
7
|
+
{% macro drop_table(relation) -%}
|
|
8
|
+
{{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}
|
|
9
|
+
{%- endmacro %}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
{% macro default__drop_table(relation) -%}
|
|
13
|
+
drop table if exists {{ relation }} cascade
|
|
14
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% macro get_rename_table_sql(relation, new_name) %}
|
|
2
|
+
{{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_rename_table_sql(relation, new_name) %}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_rename_table_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% macro get_replace_table_sql(relation, sql) %}
|
|
2
|
+
{{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_replace_table_sql(relation, sql) %}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_replace_table_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{% macro get_create_view_as_sql(relation, sql) -%}
|
|
2
|
+
{{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}
|
|
3
|
+
{%- endmacro %}
|
|
4
|
+
|
|
5
|
+
{% macro default__get_create_view_as_sql(relation, sql) -%}
|
|
6
|
+
{{ return(create_view_as(relation, sql)) }}
|
|
7
|
+
{% endmacro %}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/* {# keep logic under old name for backwards compatibility #} */
|
|
11
|
+
{% macro create_view_as(relation, sql) -%}
|
|
12
|
+
{{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}
|
|
13
|
+
{%- endmacro %}
|
|
14
|
+
|
|
15
|
+
{% macro default__create_view_as(relation, sql) -%}
|
|
16
|
+
{%- set sql_header = config.get('sql_header', none) -%}
|
|
17
|
+
|
|
18
|
+
{{ sql_header if sql_header is not none }}
|
|
19
|
+
create view {{ relation }}
|
|
20
|
+
{% set contract_config = config.get('contract') %}
|
|
21
|
+
{% if contract_config.enforced %}
|
|
22
|
+
{{ get_assert_columns_equivalent(sql) }}
|
|
23
|
+
{%- endif %}
|
|
24
|
+
as (
|
|
25
|
+
{{ sql }}
|
|
26
|
+
);
|
|
27
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{# /*
|
|
2
|
+
This was already implemented. Instead of creating a new macro that aligns with the standard,
|
|
3
|
+
this was reused and the default was maintained. This gets called by `drop_relation`, which
|
|
4
|
+
actually executes the drop, and `get_drop_sql`, which returns the template.
|
|
5
|
+
*/ #}
|
|
6
|
+
|
|
7
|
+
{% macro drop_view(relation) -%}
|
|
8
|
+
{{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}
|
|
9
|
+
{%- endmacro %}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
{% macro default__drop_view(relation) -%}
|
|
13
|
+
drop view if exists {{ relation }} cascade
|
|
14
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% macro get_rename_view_sql(relation, new_name) %}
|
|
2
|
+
{{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_rename_view_sql(relation, new_name) %}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_rename_view_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{% macro get_replace_view_sql(relation, sql) %}
|
|
2
|
+
{{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}
|
|
3
|
+
{% endmacro %}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{% macro default__get_replace_view_sql(relation, sql) %}
|
|
7
|
+
{{ exceptions.raise_compiler_error(
|
|
8
|
+
"`get_replace_view_sql` has not been implemented for this adapter."
|
|
9
|
+
) }}
|
|
10
|
+
{% endmacro %}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/* {#
|
|
14
|
+
Core materialization implementation. BigQuery and Snowflake are similar
|
|
15
|
+
because both can use `create or replace view` where the resulting view's columns
|
|
16
|
+
are not necessarily the same as those of the existing view. On Redshift, this would
|
|
17
|
+
result in: ERROR: cannot change number of columns in view
|
|
18
|
+
|
|
19
|
+
This implementation is superior to the create_temp, swap_with_existing, drop_old
|
|
20
|
+
paradigm because transactions don't run DDL queries atomically on Snowflake. By using
|
|
21
|
+
`create or replace view`, the materialization becomes atomic in nature.
|
|
22
|
+
#} */
|
|
23
|
+
|
|
24
|
+
{% macro create_or_replace_view() %}
|
|
25
|
+
{%- set identifier = model['alias'] -%}
|
|
26
|
+
|
|
27
|
+
{%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}
|
|
28
|
+
{%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}
|
|
29
|
+
|
|
30
|
+
{%- set target_relation = api.Relation.create(
|
|
31
|
+
identifier=identifier, schema=schema, database=database,
|
|
32
|
+
type='view') -%}
|
|
33
|
+
{% set grant_config = config.get('grants') %}
|
|
34
|
+
|
|
35
|
+
{{ run_hooks(pre_hooks) }}
|
|
36
|
+
|
|
37
|
+
-- If there's a table with the same name and we weren't told to full refresh,
|
|
38
|
+
-- that's an error. If we were told to full refresh, drop it. This behavior differs
|
|
39
|
+
-- for Snowflake and BigQuery, so multiple dispatch is used.
|
|
40
|
+
{%- if old_relation is not none and old_relation.is_table -%}
|
|
41
|
+
{{ handle_existing_table(should_full_refresh(), old_relation) }}
|
|
42
|
+
{%- endif -%}
|
|
43
|
+
|
|
44
|
+
-- build model
|
|
45
|
+
{% call statement('main') -%}
|
|
46
|
+
{{ get_create_view_as_sql(target_relation, sql) }}
|
|
47
|
+
{%- endcall %}
|
|
48
|
+
|
|
49
|
+
{% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}
|
|
50
|
+
{% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}
|
|
51
|
+
|
|
52
|
+
{{ run_hooks(post_hooks) }}
|
|
53
|
+
|
|
54
|
+
{{ return({'relations': [target_relation]}) }}
|
|
55
|
+
|
|
56
|
+
{% endmacro %}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
{% macro handle_existing_table(full_refresh, old_relation) %}
|
|
60
|
+
{{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}
|
|
61
|
+
{% endmacro %}
|
|
62
|
+
|
|
63
|
+
{% macro default__handle_existing_table(full_refresh, old_relation) %}
|
|
64
|
+
{{ log("Dropping relation " ~ old_relation ~ " because it is of type " ~ old_relation.type) }}
|
|
65
|
+
{{ adapter.drop_relation(old_relation) }}
|
|
66
|
+
{% endmacro %}
|