dbt-adapters 1.10.4__py3-none-any.whl → 1.12.0__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.10.4"
1
+ version = "1.12.0"
@@ -1,6 +1,16 @@
1
1
  import abc
2
2
  import time
3
- from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, TYPE_CHECKING
3
+ from typing import (
4
+ Any,
5
+ Dict,
6
+ Iterable,
7
+ Iterator,
8
+ List,
9
+ Optional,
10
+ Tuple,
11
+ TYPE_CHECKING,
12
+ Type,
13
+ )
4
14
 
5
15
  from dbt_common.events.contextvars import get_node_info
6
16
  from dbt_common.events.functions import fire_event
@@ -18,6 +28,7 @@ from dbt.adapters.events.types import (
18
28
  SQLCommit,
19
29
  SQLQuery,
20
30
  SQLQueryStatus,
31
+ AdapterEventDebug,
21
32
  )
22
33
 
23
34
  if TYPE_CHECKING:
@@ -61,7 +72,50 @@ class SQLConnectionManager(BaseConnectionManager):
61
72
  auto_begin: bool = True,
62
73
  bindings: Optional[Any] = None,
63
74
  abridge_sql_log: bool = False,
75
+ retryable_exceptions: Tuple[Type[Exception], ...] = tuple(),
76
+ retry_limit: int = 1,
64
77
  ) -> Tuple[Connection, Any]:
78
+ """
79
+ Retry function encapsulated here to avoid commitment to some
80
+ user-facing interface. Right now, Redshift commits to a 1 second
81
+ retry timeout so this serves as a default.
82
+ """
83
+
84
+ def _execute_query_with_retry(
85
+ cursor: Any,
86
+ sql: str,
87
+ bindings: Optional[Any],
88
+ retryable_exceptions: Tuple[Type[Exception], ...],
89
+ retry_limit: int,
90
+ attempt: int,
91
+ ):
92
+ """
93
+ A success sees the try exit cleanly and avoid any recursive
94
+ retries. Failure begins a sleep and retry routine.
95
+ """
96
+ try:
97
+ cursor.execute(sql, bindings)
98
+ except retryable_exceptions as e:
99
+ # Cease retries and fail when limit is hit.
100
+ if attempt >= retry_limit:
101
+ raise e
102
+
103
+ fire_event(
104
+ AdapterEventDebug(
105
+ message=f"Got a retryable error {type(e)}. {retry_limit-attempt} retries left. Retrying in 1 second.\nError:\n{e}"
106
+ )
107
+ )
108
+ time.sleep(1)
109
+
110
+ return _execute_query_with_retry(
111
+ cursor=cursor,
112
+ sql=sql,
113
+ bindings=bindings,
114
+ retryable_exceptions=retryable_exceptions,
115
+ retry_limit=retry_limit,
116
+ attempt=attempt + 1,
117
+ )
118
+
65
119
  connection = self.get_thread_connection()
66
120
  if auto_begin and connection.transaction_open is False:
67
121
  self.begin()
@@ -90,7 +144,14 @@ class SQLConnectionManager(BaseConnectionManager):
90
144
  pre = time.perf_counter()
91
145
 
92
146
  cursor = connection.handle.cursor()
93
- cursor.execute(sql, bindings)
147
+ _execute_query_with_retry(
148
+ cursor=cursor,
149
+ sql=sql,
150
+ bindings=bindings,
151
+ retryable_exceptions=retryable_exceptions,
152
+ retry_limit=retry_limit,
153
+ attempt=1,
154
+ )
94
155
 
95
156
  result = self.get_response(cursor)
96
157
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: dbt-adapters
3
- Version: 1.10.4
3
+ Version: 1.12.0
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
6
6
  Project-URL: Documentation, https://docs.getdbt.com
@@ -9,6 +9,7 @@ Project-URL: Issues, https://github.com/dbt-labs/dbt-adapters/issues
9
9
  Project-URL: Changelog, https://github.com/dbt-labs/dbt-adapters/blob/main/CHANGELOG.md
10
10
  Author-email: dbt Labs <info@dbtlabs.com>
11
11
  Maintainer-email: dbt Labs <info@dbtlabs.com>
12
+ License-File: LICENSE
12
13
  Keywords: adapter,adapters,database,dbt,dbt Cloud,dbt Core,dbt Labs,dbt-core,elt
13
14
  Classifier: Development Status :: 5 - Production/Stable
14
15
  Classifier: License :: OSI Approved :: Apache Software License
@@ -1,5 +1,5 @@
1
1
  dbt/__init__.py,sha256=iY4jdvOxcDhkdr5FiyOTZPHadKtMZDQ-qC6Fw6_EHPM,277
2
- dbt/adapters/__about__.py,sha256=bFeIO5lSYNbuL203rybNxL6TQLrhFJPNO4z1NGfLhkA,19
2
+ dbt/adapters/__about__.py,sha256=321j5SZZ1oxJ8inLWCUMR7BK6FyNniIooozPekshf70,19
3
3
  dbt/adapters/__init__.py,sha256=3noHsg-64qI0_Pw6OR9F7l1vU2_qrJvinq8POTtuaZM,252
4
4
  dbt/adapters/cache.py,sha256=WGy4ewnz-J13LverTACBW2iFhGswrWLgm-wiBrQnMzo,20084
5
5
  dbt/adapters/capability.py,sha256=M3FkC9veKnNB7a7uQyl7EHX_AGNXPChbHAkcY4cgXCY,2534
@@ -51,7 +51,7 @@ dbt/adapters/relation_configs/config_base.py,sha256=IK9oKf9TuOTLIiKX8ms_X-p4yxZv
51
51
  dbt/adapters/relation_configs/config_change.py,sha256=hf6fDWbZpKvZdM6z-OtY-GveipzfLRR_dsUZmYmXkdk,713
52
52
  dbt/adapters/relation_configs/config_validation.py,sha256=wlJUMwOEPhYFch-LRtEWfLNJMq8jL1tRhOUHmNX8nFw,1978
53
53
  dbt/adapters/sql/__init__.py,sha256=WLWZJfqc8pr1N1BMVe9gM-KQ4URJIeKfLqTuJBD1VN0,107
54
- dbt/adapters/sql/connections.py,sha256=qWsDFdenuzPDzhawPktrrHOf-5GKeMwXi4iWoQJVu4A,6547
54
+ dbt/adapters/sql/connections.py,sha256=XDmzgQ6uoTIdQNJrEsdjmaOuAZYTvaMzH03ZJueKMy8,8422
55
55
  dbt/adapters/sql/impl.py,sha256=HmH3eC-qVeCAAukjEOnUNZbH-UK32X-NL4kwb_EHzs0,10763
56
56
  dbt/include/__init__.py,sha256=qEFeq3yuf3lQKVseALmL8aPM8fpCS54B_5pry00M3hk,76
57
57
  dbt/include/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -157,7 +157,7 @@ dbt/include/global_project/macros/utils/right.sql,sha256=EwNG98CAFIwNDmarwopf7Rk
157
157
  dbt/include/global_project/macros/utils/safe_cast.sql,sha256=1mswwkDACmIi1I99JKb_-vq3kjMe4HhMRV70mW8Bt4Y,298
158
158
  dbt/include/global_project/macros/utils/split_part.sql,sha256=fXEIS0oIiYR7-4lYbb0QbZdG-q2TpV63AFd1ky4I5UM,714
159
159
  dbt/include/global_project/tests/generic/builtin.sql,sha256=p94xdyPwb2TlxgLBqCfrcRfJ1QNgsjPvBm8f0Q5eqZM,1022
160
- dbt_adapters-1.10.4.dist-info/METADATA,sha256=QUBqgu8bN7Lc4jjYzdEUEpk6EdewgQKa0fGNfutuTf4,2554
161
- dbt_adapters-1.10.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
162
- dbt_adapters-1.10.4.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
163
- dbt_adapters-1.10.4.dist-info/RECORD,,
160
+ dbt_adapters-1.12.0.dist-info/METADATA,sha256=AHsPu7P_IJ4P5nf3z-RcufHB6_KCz99B2fTbK8AUkKQ,2576
161
+ dbt_adapters-1.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
+ dbt_adapters-1.12.0.dist-info/licenses/LICENSE,sha256=9yjigiJhWcCZvQjdagGKDwrRph58QWc5P2bVSQwXo6s,11344
163
+ dbt_adapters-1.12.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any