dbt-adapters 1.16.2__py3-none-any.whl → 1.16.4__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 CHANGED
@@ -1 +1 @@
1
- version = "1.16.2"
1
+ version = "1.16.4"
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((d.lower(), s.lower()) for d, s in used_schemas)
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
@@ -130,11 +130,11 @@
130
130
  alter {{ relation.type }} {{ relation.render() }}
131
131
 
132
132
  {% for column in add_columns %}
133
- add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}
133
+ add column {{ column.quoted }} {{ column.data_type }}{{ ',' if not loop.last }}
134
134
  {% endfor %}{{ ',' if add_columns and remove_columns }}
135
135
 
136
136
  {% for column in remove_columns %}
137
- drop column {{ column.name }}{{ ',' if not loop.last }}
137
+ drop column {{ column.quoted }}{{ ',' if not loop.last }}
138
138
  {% endfor %}
139
139
 
140
140
  {%- endset -%}
@@ -4,21 +4,28 @@
4
4
 
5
5
  {% set expected_rows = config.get('expected_rows') %}
6
6
  {% set expected_sql = config.get('expected_sql') %}
7
- {% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %} %}
7
+ {% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %}
8
8
 
9
9
  {%- set target_relation = this.incorporate(type='table') -%}
10
10
  {%- set temp_relation = make_temp_relation(target_relation)-%}
11
11
  {% do run_query(get_create_table_as_sql(True, temp_relation, get_empty_subquery_sql(sql))) %}
12
12
  {%- set columns_in_relation = adapter.get_columns_in_relation(temp_relation) -%}
13
13
  {%- set column_name_to_data_types = {} -%}
14
+ {%- set column_name_to_quoted = {} -%}
14
15
  {%- for column in columns_in_relation -%}
15
16
  {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}
17
+ {%- do column_name_to_quoted.update({column.name|lower: column.quoted}) -%}
18
+ {%- endfor -%}
19
+
20
+ {%- set expected_column_names_quoted = [] -%}
21
+ {%- for column_name in tested_expected_column_names -%}
22
+ {%- do expected_column_names_quoted.append(column_name_to_quoted[column_name]) -%}
16
23
  {%- endfor -%}
17
24
 
18
25
  {% if not expected_sql %}
19
- {% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types) %}
26
+ {% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types, column_name_to_quoted) %}
20
27
  {% endif %}
21
- {% set unit_test_sql = get_unit_test_sql(sql, expected_sql, tested_expected_column_names) %}
28
+ {% set unit_test_sql = get_unit_test_sql(sql, expected_sql, expected_column_names_quoted) %}
22
29
 
23
30
  {% call statement('main', fetch_result=True) -%}
24
31
 
@@ -8,9 +8,12 @@
8
8
  {%- set columns_in_relation = adapter.get_columns_in_relation(this_or_defer_relation) -%}
9
9
 
10
10
  {%- set column_name_to_data_types = {} -%}
11
+ {%- set column_name_to_quoted = {} -%}
11
12
  {%- for column in columns_in_relation -%}
13
+
12
14
  {#-- This needs to be a case-insensitive comparison --#}
13
15
  {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}
16
+ {%- do column_name_to_quoted.update({column.name|lower: column.quoted}) -%}
14
17
  {%- endfor -%}
15
18
  {%- endif -%}
16
19
 
@@ -29,7 +32,7 @@
29
32
  {%- set default_row_copy = default_row.copy() -%}
30
33
  {%- do default_row_copy.update(formatted_row) -%}
31
34
  select
32
- {%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}
35
+ {%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%}, {%- endif %}
33
36
  {%- endfor %}
34
37
  {%- if not loop.last %}
35
38
  union all
@@ -38,14 +41,14 @@ union all
38
41
 
39
42
  {%- if (rows | length) == 0 -%}
40
43
  select
41
- {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%},{%- endif %}
44
+ {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%},{%- endif %}
42
45
  {%- endfor %}
43
46
  limit 0
44
47
  {%- endif -%}
45
48
  {% endmacro %}
46
49
 
47
50
 
48
- {% macro get_expected_sql(rows, column_name_to_data_types) %}
51
+ {% macro get_expected_sql(rows, column_name_to_data_types, column_name_to_quoted) %}
49
52
 
50
53
  {%- if (rows | length) == 0 -%}
51
54
  select * from dbt_internal_unit_test_actual
@@ -54,7 +57,7 @@ union all
54
57
  {%- for row in rows -%}
55
58
  {%- set formatted_row = format_row(row, column_name_to_data_types) -%}
56
59
  select
57
- {%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}
60
+ {%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%}, {%- endif %}
58
61
  {%- endfor %}
59
62
  {%- if not loop.last %}
60
63
  union all
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbt-adapters
3
- Version: 1.16.2
3
+ Version: 1.16.4
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
@@ -25,7 +25,7 @@ Requires-Dist: agate<2.0,>=1.0
25
25
  Requires-Dist: dbt-common<2.0,>=1.13
26
26
  Requires-Dist: dbt-protos<2.0,>=1.0.291
27
27
  Requires-Dist: mashumaro[msgpack]<3.15,>=3.9
28
- Requires-Dist: protobuf<6.0,>=5.0
28
+ Requires-Dist: protobuf<7.0,>=6.0
29
29
  Requires-Dist: pytz>=2015.7
30
30
  Requires-Dist: typing-extensions<5.0,>=4.0
31
31
  Description-Content-Type: text/markdown
@@ -1,4 +1,4 @@
1
- dbt/adapters/__about__.py,sha256=c-MIZMVgykYbxxmOCbsej1BWOTWk2v_x-ATUDJhCXjM,19
1
+ dbt/adapters/__about__.py,sha256=GMEP5Hb3pHxF0HlmSEAW6TFPPgocEsloSwNGsm4gFo8,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=0RqSVYNFVldfxjJVCBhULdgrtdUgX2daVo9fQCDcIT8,78486
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=VfTQX1DYofa9KvEwcFHHSUHkqGknFZl264T_8d6GnWQ,5681
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
@@ -105,7 +105,7 @@ dbt/include/global_project/macros/materializations/snapshots/snapshot_merge.sql,
105
105
  dbt/include/global_project/macros/materializations/snapshots/strategies.sql,sha256=AfIsRiw0YnQym5wUiWR2JpiEEky4_WBTpTtE0HJvpZw,6928
106
106
  dbt/include/global_project/macros/materializations/tests/helpers.sql,sha256=rxUxDZm4EvrDbi0H_ePghE34_QLmxGEY2o_LTMc9CU0,1731
107
107
  dbt/include/global_project/macros/materializations/tests/test.sql,sha256=LP4ya-X5n499ccab7n1jqvGbZWZsG6hqJmWlx60BvHQ,2247
108
- dbt/include/global_project/macros/materializations/tests/unit.sql,sha256=KonePuFfwcz5uJ-JW0CrEy8_q-Gl45fonngGmFvQcNU,1252
108
+ dbt/include/global_project/macros/materializations/tests/unit.sql,sha256=L3rrA5M5sK3ltfn2mBOhlq5o1s0APB5-cR48o8BRh7A,1604
109
109
  dbt/include/global_project/macros/materializations/tests/where_subquery.sql,sha256=xjuYd18tXo99OReJGQsfgEPYljUUyF00XzK4h0SJjdM,497
110
110
  dbt/include/global_project/macros/python_model/python.sql,sha256=qWoouNOP4Qdune_2Vitzmrzb0soHRzu0S4K22amVZK8,4056
111
111
  dbt/include/global_project/macros/relations/create.sql,sha256=99LLak1bhlhRw7yiI0c_4CKPlGyzqPBeBYBNeBPSmDo,701
@@ -132,7 +132,7 @@ dbt/include/global_project/macros/relations/view/create.sql,sha256=VXIsJWo4OZ_8k
132
132
  dbt/include/global_project/macros/relations/view/drop.sql,sha256=iFjhEwzip00TGd8h6T5UsXo4dK440EvgdKwR_j4XX78,497
133
133
  dbt/include/global_project/macros/relations/view/rename.sql,sha256=P4hpxlrR0wiBTZFJ8N3GyUUbqgKgMfgzUUbIWw8fui0,348
134
134
  dbt/include/global_project/macros/relations/view/replace.sql,sha256=cLqNkmTxAxsJS8g-dj4K6IikpjDGKlyCECA3nerPMzg,2593
135
- dbt/include/global_project/macros/unit_test_sql/get_fixture_sql.sql,sha256=cNZhMdNOFBGftr9ij_2TY_GCUaKGMU5YVTcIb5jHBpo,4222
135
+ dbt/include/global_project/macros/unit_test_sql/get_fixture_sql.sql,sha256=gP8G459g7U9_mPcX-ZphxTR6o9mzU3Nrjc0APIb3srk,4436
136
136
  dbt/include/global_project/macros/utils/any_value.sql,sha256=leK-fCUhDNt6MFkGofafYjv-0LtL0fkb3sJXe-aIorU,213
137
137
  dbt/include/global_project/macros/utils/array_append.sql,sha256=XsC-kchlWxVwc-_1CoBs1RkGYt8qsOAVbq5JlsV2WIc,357
138
138
  dbt/include/global_project/macros/utils/array_concat.sql,sha256=0c4w5kP1N_9BY-wppx1OBCCIDOsC1HhimkSDghjjx2Y,248
@@ -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.2.dist-info/METADATA,sha256=Ki0CCudw4-r-lS7Gpe7ipKSlX-AWhib0PX7e8Wl2RCc,4534
167
- dbt_adapters-1.16.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
168
- dbt_adapters-1.16.2.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
169
- dbt_adapters-1.16.2.dist-info/RECORD,,
166
+ dbt_adapters-1.16.4.dist-info/METADATA,sha256=ss-QPcF-Wvq5eVkHDwnB_JM2CAbI33RIN72g6ajCp5U,4534
167
+ dbt_adapters-1.16.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
168
+ dbt_adapters-1.16.4.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
169
+ dbt_adapters-1.16.4.dist-info/RECORD,,