dbt-adapters 1.16.5__py3-none-any.whl → 1.16.6__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.5"
1
+ version = "1.16.6"
dbt/adapters/base/impl.py CHANGED
@@ -30,6 +30,7 @@ from dbt.adapters.record.base import (
30
30
  AdapterGetPartitionsMetadataRecord,
31
31
  AdapterConvertTypeRecord,
32
32
  AdapterStandardizeGrantsDictRecord,
33
+ AdapterListRelationsWithoutCachingRecord,
33
34
  )
34
35
  from dbt_common.behavior_flags import Behavior, BehaviorFlag
35
36
  from dbt_common.clients.jinja import CallableMacroGenerator
@@ -772,6 +773,12 @@ class BaseAdapter(metaclass=AdapterMeta):
772
773
  "`expand_target_column_types` is not implemented for this adapter!"
773
774
  )
774
775
 
776
+ @record_function(
777
+ AdapterListRelationsWithoutCachingRecord,
778
+ method=True,
779
+ index_on_thread_id=True,
780
+ id_field_name="thread_id",
781
+ )
775
782
  @abc.abstractmethod
776
783
  def list_relations_without_caching(self, schema_relation: BaseRelation) -> List[BaseRelation]:
777
784
  """List relations in the given schema, bypassing the cache.
@@ -3,6 +3,7 @@ from dbt.adapters.catalogs._exceptions import (
3
3
  DbtCatalogIntegrationAlreadyExistsError,
4
4
  DbtCatalogIntegrationNotFoundError,
5
5
  DbtCatalogIntegrationNotSupportedError,
6
+ InvalidCatalogIntegrationConfigError,
6
7
  )
7
8
  from dbt.adapters.catalogs._integration import (
8
9
  CatalogIntegration,
@@ -30,3 +30,10 @@ class DbtCatalogIntegrationNotSupportedError(DbtConfigError):
30
30
  f"Expected one of: {', '.join(supported_catalog_types)}"
31
31
  )
32
32
  super().__init__(msg)
33
+
34
+
35
+ class InvalidCatalogIntegrationConfigError(DbtConfigError):
36
+ def __init__(self, catalog_name: str, msg: str) -> None:
37
+ self.catalog_name = catalog_name
38
+ msg = f"Invalid catalog integration config: {self.catalog_name}. {msg}"
39
+ super().__init__(msg)
@@ -255,3 +255,15 @@ class RelationWrongTypeError(CompilationError):
255
255
  )
256
256
 
257
257
  return msg
258
+
259
+
260
+ class InvalidRelationConfigError(CompilationError):
261
+ def __init__(self, relation, config, msg):
262
+ self.relation = relation
263
+ self.config = config
264
+ self.msg = msg
265
+ super().__init__(msg=self.get_message())
266
+
267
+ def get_message(self) -> str:
268
+ msg = f"Invalid relation config: {self.config}"
269
+ return msg
@@ -2,14 +2,15 @@
2
2
 
3
3
  import dataclasses
4
4
 
5
- from typing import Optional, Tuple, Dict, Any, TYPE_CHECKING
5
+ from typing import Optional, Tuple, Dict, Any, TYPE_CHECKING, List
6
6
 
7
7
  from dbt.adapters.contracts.connection import AdapterResponse
8
- from dbt.adapters.record.serialization import serialize_agate_table
8
+ from dbt.adapters.record.serialization import serialize_agate_table, serialize_bindings
9
9
  from dbt_common.record import Record, Recorder
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from agate import Table
13
+ from dbt.adapters.base.relation import BaseRelation
13
14
 
14
15
 
15
16
  @dataclasses.dataclass
@@ -161,3 +162,85 @@ class AdapterStandardizeGrantsDictRecord(Record):
161
162
  params_cls = AdapterStandardizeGrantsDictParams
162
163
  result_cls = AdapterStandardizeGrantsDictResult
163
164
  group = "Available"
165
+
166
+
167
+ @dataclasses.dataclass
168
+ class AdapterAddQueryParams:
169
+ thread_id: str
170
+ sql: str
171
+ auto_begin: bool = True
172
+ bindings: Optional[Any] = None
173
+ abridge_sql_log: bool = False
174
+
175
+ def _to_dict(self):
176
+ return {
177
+ "thread_id": self.thread_id,
178
+ "sql": self.sql,
179
+ "auto_begin": self.auto_begin,
180
+ "bindings": serialize_bindings(self.bindings),
181
+ "abridge_sql_log": self.abridge_sql_log,
182
+ }
183
+
184
+
185
+ @dataclasses.dataclass
186
+ class AdapterAddQueryResult:
187
+ return_val: Tuple[str, str]
188
+
189
+ def _to_dict(self):
190
+ return {
191
+ "return_val": {
192
+ "conn": "conn",
193
+ "cursor": "cursor",
194
+ }
195
+ }
196
+
197
+
198
+ @Recorder.register_record_type
199
+ class AdapterAddQueryRecord(Record):
200
+ params_cls = AdapterAddQueryParams
201
+ result_cls = AdapterAddQueryResult
202
+ group = "Available"
203
+
204
+
205
+ @dataclasses.dataclass
206
+ class AdapterListRelationsWithoutCachingParams:
207
+ thread_id: str
208
+ schema_relation: "BaseRelation"
209
+
210
+ def _to_dict(self):
211
+ from dbt.adapters.record.serialization import serialize_base_relation
212
+
213
+ return {
214
+ "thread_id": self.thread_id,
215
+ "schema_relation": serialize_base_relation(self.schema_relation),
216
+ }
217
+
218
+ def _from_dict(self, data: Dict[str, Any]):
219
+ from dbt.adapters.record.serialization import deserialize_base_relation
220
+
221
+ self.thread_id = data["thread_id"]
222
+ self.schema_relation = deserialize_base_relation(data["schema_relation"])
223
+
224
+
225
+ @dataclasses.dataclass
226
+ class AdapterListRelationsWithoutCachingResult:
227
+ return_val: List["BaseRelation"]
228
+
229
+ def _to_dict(self):
230
+ from dbt.adapters.record.serialization import serialize_base_relation_list
231
+
232
+ return {"return_val": serialize_base_relation_list(self.return_val)}
233
+
234
+ def _from_dict(self, data: Dict[str, Any]):
235
+ from dbt.adapters.record.serialization import deserialize_base_relation_list
236
+
237
+ self.return_val = deserialize_base_relation_list(data["return_val"])
238
+
239
+
240
+ @Recorder.register_record_type
241
+ class AdapterListRelationsWithoutCachingRecord(Record):
242
+ """Implements record/replay support for the BaseAdapter.list_relations_without_caching() method."""
243
+
244
+ params_cls = AdapterListRelationsWithoutCachingParams
245
+ result_cls = AdapterListRelationsWithoutCachingResult
246
+ group = "Available"
@@ -1,9 +1,10 @@
1
1
  from datetime import datetime, date
2
2
  from decimal import Decimal
3
- from typing import Any, Dict, TYPE_CHECKING
3
+ from typing import Any, Dict, TYPE_CHECKING, List, Union
4
4
 
5
5
  if TYPE_CHECKING:
6
6
  from agate import Table
7
+ from dbt.adapters.base.relation import BaseRelation
7
8
 
8
9
 
9
10
  def _column_filter(val: Any) -> Any:
@@ -29,3 +30,34 @@ def serialize_agate_table(table: "Table") -> Dict[str, Any]:
29
30
  "column_types": [t.__class__.__name__ for t in table.column_types],
30
31
  "rows": rows,
31
32
  }
33
+
34
+
35
+ def serialize_bindings(bindings: Any) -> Union[None, List[Any], str]:
36
+ if bindings is None:
37
+ return None
38
+ elif isinstance(bindings, list):
39
+ return list(map(_column_filter, bindings))
40
+ else:
41
+ return "bindings"
42
+
43
+
44
+ def serialize_base_relation(relation: "BaseRelation") -> Dict[str, Any]:
45
+ """Serialize a BaseRelation object for recording."""
46
+ return relation.to_dict(omit_none=True)
47
+
48
+
49
+ def serialize_base_relation_list(relations: List["BaseRelation"]) -> List[Dict[str, Any]]:
50
+ """Serialize a list of BaseRelation objects for recording."""
51
+ return [serialize_base_relation(relation) for relation in relations]
52
+
53
+
54
+ def deserialize_base_relation(relation_dict: Dict[str, Any]) -> "BaseRelation":
55
+ """Deserialize a BaseRelation object from a dictionary."""
56
+ from dbt.adapters.base.relation import BaseRelation
57
+
58
+ return BaseRelation.from_dict(relation_dict)
59
+
60
+
61
+ def deserialize_base_relation_list(relations_data: List[Dict[str, Any]]) -> List["BaseRelation"]:
62
+ """Deserialize a list of BaseRelation objects from dictionaries."""
63
+ return [deserialize_base_relation(relation_dict) for relation_dict in relations_data]
dbt/adapters/sql/impl.py CHANGED
@@ -8,7 +8,7 @@ from dbt.adapters.cache import _make_ref_key_dict
8
8
  from dbt.adapters.contracts.connection import AdapterResponse, Connection
9
9
  from dbt.adapters.events.types import ColTypeChange, SchemaCreation, SchemaDrop
10
10
  from dbt.adapters.exceptions import RelationTypeNullError
11
- from dbt.adapters.record.base import AdapterTestSqlRecord
11
+ from dbt.adapters.record.base import AdapterTestSqlRecord, AdapterAddQueryRecord
12
12
  from dbt.adapters.sql.connections import SQLConnectionManager
13
13
 
14
14
  LIST_RELATIONS_MACRO_NAME = "list_relations_without_caching"
@@ -49,6 +49,9 @@ class SQLAdapter(BaseAdapter):
49
49
  connections: SQLConnectionManager
50
50
 
51
51
  @available.parse(lambda *a, **k: (None, None))
52
+ @record_function(
53
+ AdapterAddQueryRecord, method=True, index_on_thread_id=True, id_field_name="thread_id"
54
+ )
52
55
  def add_query(
53
56
  self,
54
57
  sql: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbt-adapters
3
- Version: 1.16.5
3
+ Version: 1.16.6
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=Qz0BE08lu2_u7MixE7GM_8vIJjUC10H2IxTPA0I0kWU,19
1
+ dbt/adapters/__about__.py,sha256=yVGsgH-1PnNg3ANhU0Ki30jCFRQx1ac_0O7ZJ8deZa8,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,15 +11,15 @@ 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=_azN61jgWam6SWFhTJGYTI7H3ME9IQDUjv4A2dyf-mc,78968
14
+ dbt/adapters/base/impl.py,sha256=uACwbMYJL9KykHdckf-9Egz4MBGecwOsSrYtU72OEx8,79181
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
18
18
  dbt/adapters/base/relation.py,sha256=eePneHZQ-bb0ZFaEpC_1xzsxJF38e6k7b3FUxD8PK0I,19383
19
- dbt/adapters/catalogs/__init__.py,sha256=9Lsz26jcljxwJLBgfHHQMqOyoKNahrqxSst0YN9WAy8,456
19
+ dbt/adapters/catalogs/__init__.py,sha256=jiZb5IchAHnHSHz5J44l3Wzc0-oHeYXv4_7SBKOL7Pw,498
20
20
  dbt/adapters/catalogs/_client.py,sha256=bIXZxEL1-4kSXHFPnMw3egIOx1fKZmjxKiO1Wv-KuHg,2258
21
21
  dbt/adapters/catalogs/_constants.py,sha256=8O5wLK4oVqirpC9ap7PIXodq8XtkQhHJ5W0OU1xtwjk,55
22
- dbt/adapters/catalogs/_exceptions.py,sha256=5zkSmjUG5y_Dzv0AAUptsJpNDHnmb8D0mUb_HIQCj_I,1133
22
+ dbt/adapters/catalogs/_exceptions.py,sha256=exanVSndLgMlpCyVIg5p1AUkQO2HiI4bkFtS3ADFVUQ,1407
23
23
  dbt/adapters/catalogs/_integration.py,sha256=0acuF_Awoe-GJrCdNwBQldtgRmBtpqYpZkTPRVJFhys,6594
24
24
  dbt/adapters/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  dbt/adapters/clients/jinja.py,sha256=NsZOiBpOLunS46hRL5OcX1MpY3Ih6_87Vgz4qd_PNbc,768
@@ -36,13 +36,13 @@ dbt/adapters/events/types.py,sha256=cxGUlR2WceSOis81FwHS7rwfFpxCmy31ur5Yp8Pz4o0,
36
36
  dbt/adapters/exceptions/__init__.py,sha256=LxRkxHARMzrPegrjha5tQ8vQi1PnL_ooq1SVqm9aiZs,1268
37
37
  dbt/adapters/exceptions/alias.py,sha256=QlCd2jvatfndec1DQLMMBJ-C_7w8yAySuAFHK2ga1g8,798
38
38
  dbt/adapters/exceptions/cache.py,sha256=u720DQQKm8pyf_9loD9HGA9WgaeZAlg0sBn0sGc-rhA,2492
39
- dbt/adapters/exceptions/compilation.py,sha256=2QsAX-z_1K4q8jGtvbC1JM6dEh7lyOF7rTWkV6RXC8o,8720
39
+ dbt/adapters/exceptions/compilation.py,sha256=ylUvVLwlzeKqFr16pGhSqHBbE3Z-lneDppUQtNmrE-o,9065
40
40
  dbt/adapters/exceptions/connection.py,sha256=x82j2Ix242Slm6Ima8Tol3GLOB9yZYH5lq6IV1WKq54,445
41
41
  dbt/adapters/exceptions/database.py,sha256=nIXJdQyPQOZaiKvCkQ3MoKlKOiaN58rtDZflw3CSkug,1618
42
42
  dbt/adapters/record/__init__.py,sha256=u_0eJzN5RL90oL-RNoP2wWGMCGp0kG0lZ0uVWnnGdxs,123
43
- dbt/adapters/record/base.py,sha256=oqBeddunk9bAyNZBC2pWQohYtD6_ju_tf_74I6NAN04,4277
43
+ dbt/adapters/record/base.py,sha256=4HAGpxUX-9JoWgrWctM29xX_EBfVUD-FbLGukQH33kM,6714
44
44
  dbt/adapters/record/handle.py,sha256=hCQpDmZGKqJXrSqgYcb-F542TZi069uz1MY9fS15INo,1907
45
- dbt/adapters/record/serialization.py,sha256=ehcLioi4J7TujP58fMNGcePuMxx-2G4Dj1KoYm6j6FU,756
45
+ dbt/adapters/record/serialization.py,sha256=aysH908v3qURycAPZ4a-TwDa5UQZrcmaeu1Zj_RFTvE,1987
46
46
  dbt/adapters/record/cursor/cursor.py,sha256=AW0B1g0j5mn7pUnvsE7zd4_Zi7cSFOsyvPbE2HV0CPI,2967
47
47
  dbt/adapters/record/cursor/description.py,sha256=5LNebP2AF2aicPWfM9FsD5r7SAmdac8TX_4NZfJQgPk,1060
48
48
  dbt/adapters/record/cursor/execute.py,sha256=f8Yc1MKExj7QLbFnK8WnnwsoGESuYMWnFWhytbcAPjc,1271
@@ -57,7 +57,7 @@ dbt/adapters/relation_configs/config_change.py,sha256=hf6fDWbZpKvZdM6z-OtY-Gveip
57
57
  dbt/adapters/relation_configs/config_validation.py,sha256=wlJUMwOEPhYFch-LRtEWfLNJMq8jL1tRhOUHmNX8nFw,1978
58
58
  dbt/adapters/sql/__init__.py,sha256=WLWZJfqc8pr1N1BMVe9gM-KQ4URJIeKfLqTuJBD1VN0,107
59
59
  dbt/adapters/sql/connections.py,sha256=N7Mmg9ZS5ztKQCbJgbb1jwVhaBeMBqnR_3SWxEytxzY,8453
60
- dbt/adapters/sql/impl.py,sha256=dhpvlxc3mZWdcP42xMzW8_nM2zJGMMt1_hLUUfXx3Dw,10944
60
+ dbt/adapters/sql/impl.py,sha256=mTzK7vK-Nf6PdJwh8lzMnqOP5I6663s1ZMc3LomsYh4,11090
61
61
  dbt/include/__init__.py,sha256=qEFeq3yuf3lQKVseALmL8aPM8fpCS54B_5pry00M3hk,76
62
62
  dbt/include/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
63
  dbt/include/global_project/__init__.py,sha256=-0HL5OkeJSrxglm1Y-UltTiBPY2BbWx8ZpTiJ7ypSvw,73
@@ -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.5.dist-info/METADATA,sha256=otMClzeh3gNK273cCp3pI2qGK6GYjumhFN6RYt_ka9k,4534
167
- dbt_adapters-1.16.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
168
- dbt_adapters-1.16.5.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
169
- dbt_adapters-1.16.5.dist-info/RECORD,,
166
+ dbt_adapters-1.16.6.dist-info/METADATA,sha256=vmRysouwZKtOTcNN_y7mnp8m1zKkYdPtrk-9PpKvwW0,4534
167
+ dbt_adapters-1.16.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
168
+ dbt_adapters-1.16.6.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
169
+ dbt_adapters-1.16.6.dist-info/RECORD,,