dbt-adapters 1.16.1__py3-none-any.whl → 1.16.3__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/adapters/__about__.py +1 -1
- dbt/adapters/base/impl.py +13 -1
- dbt/include/global_project/macros/adapters/columns.sql +9 -2
- dbt/include/global_project/macros/materializations/models/clone/clone.sql +9 -9
- dbt/include/global_project/macros/materializations/snapshots/helpers.sql +10 -1
- {dbt_adapters-1.16.1.dist-info → dbt_adapters-1.16.3.dist-info}/METADATA +1 -1
- {dbt_adapters-1.16.1.dist-info → dbt_adapters-1.16.3.dist-info}/RECORD +9 -9
- {dbt_adapters-1.16.1.dist-info → dbt_adapters-1.16.3.dist-info}/WHEEL +0 -0
- {dbt_adapters-1.16.1.dist-info → dbt_adapters-1.16.3.dist-info}/licenses/LICENSE +0 -0
dbt/adapters/__about__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "1.16.
|
|
1
|
+
version = "1.16.3"
|
dbt/adapters/base/impl.py
CHANGED
|
@@ -103,7 +103,9 @@ from dbt.adapters.exceptions import (
|
|
|
103
103
|
UnexpectedNonTimestampError,
|
|
104
104
|
)
|
|
105
105
|
from dbt.adapters.protocol import AdapterConfig, MacroContextGeneratorCallable
|
|
106
|
+
from dbt.adapters.events.logging import AdapterLogger
|
|
106
107
|
|
|
108
|
+
logger = AdapterLogger(__name__)
|
|
107
109
|
if TYPE_CHECKING:
|
|
108
110
|
import agate
|
|
109
111
|
|
|
@@ -153,15 +155,25 @@ def _catalog_filter_schemas(
|
|
|
153
155
|
"""Return a function that takes a row and decides if the row should be
|
|
154
156
|
included in the catalog output.
|
|
155
157
|
"""
|
|
156
|
-
schemas = frozenset(
|
|
158
|
+
schemas = frozenset(
|
|
159
|
+
(d.lower(), s.lower()) for d, s in used_schemas if d is not None and s is not None
|
|
160
|
+
)
|
|
161
|
+
if null_schemas := [d for d, s in used_schemas if d is None or s is None]:
|
|
162
|
+
logger.debug(
|
|
163
|
+
f"used_schemas contains None for either database or schema, skipping {null_schemas}"
|
|
164
|
+
)
|
|
157
165
|
|
|
158
166
|
def test(row: "agate.Row") -> bool:
|
|
159
167
|
table_database = _expect_row_value("table_database", row)
|
|
160
168
|
table_schema = _expect_row_value("table_schema", row)
|
|
161
169
|
# the schema may be present but None, which is not an error and should
|
|
162
170
|
# be filtered out
|
|
171
|
+
|
|
163
172
|
if table_schema is None:
|
|
164
173
|
return False
|
|
174
|
+
if table_database is None:
|
|
175
|
+
logger.debug(f"table_database is None, skipping {table_schema}")
|
|
176
|
+
return False
|
|
165
177
|
return (table_database.lower(), table_schema.lower()) in schemas
|
|
166
178
|
|
|
167
179
|
return test
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
{{ return(columns) }}
|
|
17
17
|
{% endmacro %}
|
|
18
18
|
|
|
19
|
+
{%- macro get_list_of_column_names(columns) -%}
|
|
20
|
+
{% set col_names = [] %}
|
|
21
|
+
{% for col in columns %}
|
|
22
|
+
{% do col_names.append(col.name) %}
|
|
23
|
+
{% endfor %}
|
|
24
|
+
{{ return(col_names) }}
|
|
25
|
+
{% endmacro %}
|
|
19
26
|
|
|
20
27
|
{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}
|
|
21
28
|
{{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}
|
|
@@ -123,11 +130,11 @@
|
|
|
123
130
|
alter {{ relation.type }} {{ relation.render() }}
|
|
124
131
|
|
|
125
132
|
{% for column in add_columns %}
|
|
126
|
-
add column {{ column.
|
|
133
|
+
add column {{ column.quoted }} {{ column.data_type }}{{ ',' if not loop.last }}
|
|
127
134
|
{% endfor %}{{ ',' if add_columns and remove_columns }}
|
|
128
135
|
|
|
129
136
|
{% for column in remove_columns %}
|
|
130
|
-
drop column {{ column.
|
|
137
|
+
drop column {{ column.quoted }}{{ ',' if not loop.last }}
|
|
131
138
|
{% endfor %}
|
|
132
139
|
|
|
133
140
|
{%- endset -%}
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
{% endif %}
|
|
33
33
|
|
|
34
34
|
-- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'
|
|
35
|
-
{%
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
{% if target_relation.database == defer_relation.database and
|
|
36
|
+
target_relation.schema == defer_relation.schema and
|
|
37
|
+
target_relation.identifier == defer_relation.identifier %}
|
|
38
|
+
{{ log("Target relation and defer relation are the same, skipping clone for relation: " ~ target_relation.render()) }}
|
|
39
|
+
{% else %}
|
|
40
|
+
{% call statement('main') %}
|
|
41
|
+
{{ create_or_replace_clone(target_relation, defer_relation) }}
|
|
42
|
+
{% endcall %}
|
|
43
|
+
{% endif %}
|
|
44
44
|
{% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}
|
|
45
45
|
{% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}
|
|
46
46
|
{% do persist_docs(target_relation, model) %}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{% macro default__create_columns(relation, columns) %}
|
|
9
9
|
{% for column in columns %}
|
|
10
10
|
{% call statement() %}
|
|
11
|
-
alter table {{ relation.render() }} add column
|
|
11
|
+
alter table {{ relation.render() }} add column {{ adapter.quote(column.name) }} {{ column.data_type }};
|
|
12
12
|
{% endcall %}
|
|
13
13
|
{% endfor %}
|
|
14
14
|
{% endmacro %}
|
|
@@ -165,14 +165,23 @@
|
|
|
165
165
|
{%- endif %}
|
|
166
166
|
|
|
167
167
|
{%- if strategy.hard_deletes == 'new_record' %}
|
|
168
|
+
{% set snapshotted_cols = get_list_of_column_names(get_columns_in_relation(target_relation)) %}
|
|
168
169
|
{% set source_sql_cols = get_column_schema_from_query(source_sql) %}
|
|
169
170
|
,
|
|
170
171
|
deletion_records as (
|
|
171
172
|
|
|
172
173
|
select
|
|
173
174
|
'insert' as dbt_change_type,
|
|
175
|
+
{#
|
|
176
|
+
If a column has been added to the source it won't yet exist in the
|
|
177
|
+
snapshotted table so we insert a null value as a placeholder for the column.
|
|
178
|
+
#}
|
|
174
179
|
{%- for col in source_sql_cols -%}
|
|
180
|
+
{%- if col.name in snapshotted_cols -%}
|
|
175
181
|
snapshotted_data.{{ adapter.quote(col.column) }},
|
|
182
|
+
{%- else -%}
|
|
183
|
+
NULL as {{ adapter.quote(col.column) }},
|
|
184
|
+
{%- endif -%}
|
|
176
185
|
{% endfor -%}
|
|
177
186
|
{%- if strategy.unique_key | is_list -%}
|
|
178
187
|
{%- for key in strategy.unique_key -%}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dbt-adapters
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.3
|
|
4
4
|
Summary: The set of adapter protocols and base functionality that supports integration with dbt-core
|
|
5
5
|
Project-URL: Homepage, https://github.com/dbt-labs/dbt-adapters/tree/main/dbt-adapters
|
|
6
6
|
Project-URL: Documentation, https://docs.getdbt.com
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
dbt/adapters/__about__.py,sha256=
|
|
1
|
+
dbt/adapters/__about__.py,sha256=WY0jp7TYTHaG2jpqqG99tmrgb7dBHylc_TYeEGs6j3s,19
|
|
2
2
|
dbt/adapters/__init__.py,sha256=3noHsg-64qI0_Pw6OR9F7l1vU2_qrJvinq8POTtuaZM,252
|
|
3
3
|
dbt/adapters/cache.py,sha256=WGy4ewnz-J13LverTACBW2iFhGswrWLgm-wiBrQnMzo,20084
|
|
4
4
|
dbt/adapters/capability.py,sha256=M3FkC9veKnNB7a7uQyl7EHX_AGNXPChbHAkcY4cgXCY,2534
|
|
@@ -11,7 +11,7 @@ dbt/adapters/base/README.md,sha256=muHQntC07Lh6L1XfVgwKhV5RltOPBLYPdQqd8_7l34c,5
|
|
|
11
11
|
dbt/adapters/base/__init__.py,sha256=Nc8lQVkOzAqdcxk4cw4E_raxN9CAWMwhQx4STdiicxg,456
|
|
12
12
|
dbt/adapters/base/column.py,sha256=Uj20UixoxCn2rlv4QDNONyys6CDkDFyG3anCXKf0T2c,5350
|
|
13
13
|
dbt/adapters/base/connections.py,sha256=-C5dOwGgMKH8n_v6wjwOxV7chBdS0GjOGwNQCUbhhWc,16951
|
|
14
|
-
dbt/adapters/base/impl.py,sha256=
|
|
14
|
+
dbt/adapters/base/impl.py,sha256=_azN61jgWam6SWFhTJGYTI7H3ME9IQDUjv4A2dyf-mc,78968
|
|
15
15
|
dbt/adapters/base/meta.py,sha256=c5j0qeGec1cAi-IlVV_JkhMk01p5XqbtGj02uxGP1S4,5686
|
|
16
16
|
dbt/adapters/base/plugin.py,sha256=rm0GjNHnWM2mn0GJOjciZLwn-02xlzWCoMT9u-epwP0,1076
|
|
17
17
|
dbt/adapters/base/query_headers.py,sha256=rHgux9b_vPp_xRsg8QU3NE202Hho4i4zO9u9Gx_BCF4,3651
|
|
@@ -64,7 +64,7 @@ dbt/include/global_project/__init__.py,sha256=-0HL5OkeJSrxglm1Y-UltTiBPY2BbWx8Zp
|
|
|
64
64
|
dbt/include/global_project/dbt_project.yml,sha256=RTtOhnBpEL0gbd1GlpxuVr6eZJBPvgWfNw-F88sKQ-w,109
|
|
65
65
|
dbt/include/global_project/docs/overview.md,sha256=VuObM4pcS-TvwYeAjjUbe0TBhEnxf6g30EPWrGjya_w,1824
|
|
66
66
|
dbt/include/global_project/macros/adapters/apply_grants.sql,sha256=3NUJLWmNE0ZAWxc1LuIpo6-dTfLEBjX1Os5BdDb_IOQ,6861
|
|
67
|
-
dbt/include/global_project/macros/adapters/columns.sql,sha256=
|
|
67
|
+
dbt/include/global_project/macros/adapters/columns.sql,sha256=3TU-Bd5legmB2iEon_PbIO_HKGFKrvQT3Eb1IGtF_1Y,5685
|
|
68
68
|
dbt/include/global_project/macros/adapters/freshness.sql,sha256=bl2Kn7s2pDMzrJWeLXYyUVYXDmloLxntjOgyWSDcgCs,1200
|
|
69
69
|
dbt/include/global_project/macros/adapters/indexes.sql,sha256=DasPn32Cm0OZyjBPBWzL4BpK9PZ3xF_Pu8Nh4NgASaw,1366
|
|
70
70
|
dbt/include/global_project/macros/adapters/metadata.sql,sha256=meNIc3z4lXdh1lDb-K1utKb8VzAVuN23E6XWgMZGDhQ,3512
|
|
@@ -89,7 +89,7 @@ dbt/include/global_project/macros/materializations/models/materialized_view.sql,
|
|
|
89
89
|
dbt/include/global_project/macros/materializations/models/table.sql,sha256=F9ogmZofhPdzKwhhFJ_GfI5QRXQxLjTl6xTiCgulQ9g,2682
|
|
90
90
|
dbt/include/global_project/macros/materializations/models/view.sql,sha256=LPqM3aTsWiAalFz322aTpqKqCdl4hxN8ubcwXZIIDDw,3249
|
|
91
91
|
dbt/include/global_project/macros/materializations/models/clone/can_clone_table.sql,sha256=YVq2f574IxMDuEv5rbaTvUpLLqc-jQfyOgBQJQGWcmk,187
|
|
92
|
-
dbt/include/global_project/macros/materializations/models/clone/clone.sql,sha256=
|
|
92
|
+
dbt/include/global_project/macros/materializations/models/clone/clone.sql,sha256=hd6AFfjtVWqq10okMnCeBCnRxid0PvY7prIYFA7Wt44,2813
|
|
93
93
|
dbt/include/global_project/macros/materializations/models/clone/create_or_replace_clone.sql,sha256=qr33DwFOpRG0wGVsGvr63-MexYMNZC9xKdGOPmICp_c,367
|
|
94
94
|
dbt/include/global_project/macros/materializations/models/incremental/column_helpers.sql,sha256=hslQlGKW0oW97srfugsFVRR-L6RrzRcnwr3uLhzI0X4,2577
|
|
95
95
|
dbt/include/global_project/macros/materializations/models/incremental/incremental.sql,sha256=yOG-Rsv_j6JhGIHdfFk77_DoILFgFqsLN27R5LdCnZM,4546
|
|
@@ -99,7 +99,7 @@ dbt/include/global_project/macros/materializations/models/incremental/on_schema_
|
|
|
99
99
|
dbt/include/global_project/macros/materializations/models/incremental/strategies.sql,sha256=ORGWiYfj-b3_VIps9FDlyx-Q4A2hZzX2aYLocW8b6pU,2613
|
|
100
100
|
dbt/include/global_project/macros/materializations/seeds/helpers.sql,sha256=Y15ej-D3gm1ExIOMNT208q43gRk8d985WQBuGSooNL0,3920
|
|
101
101
|
dbt/include/global_project/macros/materializations/seeds/seed.sql,sha256=YSoGzVO3iIUiOKIUM9G7yApGLFH4O9bv_d4KjHo3p4Q,2155
|
|
102
|
-
dbt/include/global_project/macros/materializations/snapshots/helpers.sql,sha256=
|
|
102
|
+
dbt/include/global_project/macros/materializations/snapshots/helpers.sql,sha256=EdKKm0_uEot5msQbs77iFdTJh-HmuV8hgTLVDT3MNo0,12468
|
|
103
103
|
dbt/include/global_project/macros/materializations/snapshots/snapshot.sql,sha256=clIZtCE7vvOXxzz1t2KlmPZM7AuSGsK7MInspo0N5Qg,4043
|
|
104
104
|
dbt/include/global_project/macros/materializations/snapshots/snapshot_merge.sql,sha256=WaGQCuv4o_qxBw7b2KQvUnSg0UkPklwAQHK1-QngN_M,1369
|
|
105
105
|
dbt/include/global_project/macros/materializations/snapshots/strategies.sql,sha256=AfIsRiw0YnQym5wUiWR2JpiEEky4_WBTpTtE0HJvpZw,6928
|
|
@@ -163,7 +163,7 @@ dbt/include/global_project/macros/utils/right.sql,sha256=EwNG98CAFIwNDmarwopf7Rk
|
|
|
163
163
|
dbt/include/global_project/macros/utils/safe_cast.sql,sha256=1mswwkDACmIi1I99JKb_-vq3kjMe4HhMRV70mW8Bt4Y,298
|
|
164
164
|
dbt/include/global_project/macros/utils/split_part.sql,sha256=fXEIS0oIiYR7-4lYbb0QbZdG-q2TpV63AFd1ky4I5UM,714
|
|
165
165
|
dbt/include/global_project/tests/generic/builtin.sql,sha256=p94xdyPwb2TlxgLBqCfrcRfJ1QNgsjPvBm8f0Q5eqZM,1022
|
|
166
|
-
dbt_adapters-1.16.
|
|
167
|
-
dbt_adapters-1.16.
|
|
168
|
-
dbt_adapters-1.16.
|
|
169
|
-
dbt_adapters-1.16.
|
|
166
|
+
dbt_adapters-1.16.3.dist-info/METADATA,sha256=naEgTVoEUvyA4qDpzYSBo3Sga5Cek77wMQXIxhwzmGk,4534
|
|
167
|
+
dbt_adapters-1.16.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
168
|
+
dbt_adapters-1.16.3.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
|
|
169
|
+
dbt_adapters-1.16.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|