databricks-sql-connector 2.9.4b1__tar.gz → 2.9.6__tar.gz

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.
Files changed (34) hide show
  1. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/CHANGELOG.md +27 -6
  2. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/PKG-INFO +1 -1
  3. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/pyproject.toml +1 -1
  4. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/__init__.py +3 -3
  5. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/thrift_http_client.py +0 -4
  6. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/cloudfetch/downloader.py +5 -3
  7. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_backend.py +2 -2
  8. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/utils.py +3 -0
  9. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/LICENSE +0 -0
  10. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/README.md +0 -0
  11. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/__init__.py +0 -0
  12. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/__init__.py +0 -0
  13. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/auth.py +0 -0
  14. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/authenticators.py +0 -0
  15. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/endpoint.py +0 -0
  16. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/oauth.py +0 -0
  17. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/oauth_http_handler.py +0 -0
  18. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/auth/retry.py +0 -0
  19. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/client.py +0 -0
  20. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/cloudfetch/download_manager.py +0 -0
  21. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/exc.py +0 -0
  22. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/experimental/__init__.py +0 -0
  23. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/experimental/oauth_persistence.py +0 -0
  24. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_api/TCLIService/TCLIService-remote +0 -0
  25. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_api/TCLIService/TCLIService.py +0 -0
  26. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_api/TCLIService/__init__.py +0 -0
  27. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_api/TCLIService/constants.py +0 -0
  28. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_api/TCLIService/ttypes.py +0 -0
  29. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/thrift_api/__init__.py +0 -0
  30. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sql/types.py +0 -0
  31. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sqlalchemy/__init__.py +0 -0
  32. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sqlalchemy/dialect/__init__.py +0 -0
  33. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sqlalchemy/dialect/base.py +0 -0
  34. {databricks_sql_connector-2.9.4b1 → databricks_sql_connector-2.9.6}/src/databricks/sqlalchemy/dialect/compiler.py +0 -0
@@ -1,8 +1,14 @@
1
1
  # Release History
2
2
 
3
- ## 2.9.4 (Unreleased)
3
+ ## 2.9.6 (2024-04-18)
4
4
 
5
- ## 2.9.4b1 (2024-02-16)
5
+ - Fix: Remove cookie handling code (#379)
6
+
7
+ ## 2.9.5 (2024-03-19)
8
+
9
+ - Fix: retry-after has a default value of 1 (#371)
10
+
11
+ ## 2.9.4 (2024-02-20)
6
12
 
7
13
  - Fix: Cloud fetch file download errors (#356)
8
14
  - Fix: Redact the URL query parameters from the urllib3.connectionpool logs (#341)
@@ -70,6 +76,7 @@
70
76
  - Other: Relax sqlalchemy required version as it was unecessarily strict.
71
77
 
72
78
  ## 2.5.0 (2023-04-14)
79
+
73
80
  - Add support for External Auth providers
74
81
  - Fix: Python HTTP proxies were broken
75
82
  - Other: All Thrift requests that timeout during connection will be automatically retried
@@ -91,8 +98,8 @@
91
98
 
92
99
  ## 2.2.2 (2023-01-03)
93
100
 
94
- - Support custom oauth client id and redirect port
95
- - Fix: Add none check on _oauth_persistence in DatabricksOAuthProvider
101
+ - Support custom oauth client id and redirect port
102
+ - Fix: Add none check on \_oauth_persistence in DatabricksOAuthProvider
96
103
 
97
104
  ## 2.2.1 (2022-11-29)
98
105
 
@@ -124,57 +131,71 @@ Huge thanks to @dbaxa for contributing this change!
124
131
 
125
132
  - Add retry logic for `GetOperationStatus` requests that fail with an `OSError`
126
133
  - Reorganised code to use Poetry for dependency management.
134
+
127
135
  ## 2.0.2 (2022-05-04)
136
+
128
137
  - Better exception handling in automatic connection close
129
138
 
130
139
  ## 2.0.1 (2022-04-21)
140
+
131
141
  - Fixed Pandas dependency in setup.cfg to be >= 1.2.0
132
142
 
133
143
  ## 2.0.0 (2022-04-19)
144
+
134
145
  - Initial stable release of V2
135
- - Added better support for complex types, so that in Databricks runtime 10.3+, Arrays, Maps and Structs will get
146
+ - Added better support for complex types, so that in Databricks runtime 10.3+, Arrays, Maps and Structs will get
136
147
  deserialized as lists, lists of tuples and dicts, respectively.
137
148
  - Changed the name of the metadata arg to http_headers
138
149
 
139
150
  ## 2.0.b2 (2022-04-04)
151
+
140
152
  - Change import of collections.Iterable to collections.abc.Iterable to make the library compatible with Python 3.10
141
153
  - Fixed bug with .tables method so that .tables works as expected with Unity-Catalog enabled endpoints
142
154
 
143
155
  ## 2.0.0b1 (2022-03-04)
156
+
144
157
  - Fix packaging issue (dependencies were not being installed properly)
145
158
  - Fetching timestamp results will now return aware instead of naive timestamps
146
159
  - The client will now default to using simplified error messages
147
160
 
148
161
  ## 2.0.0b (2022-02-08)
162
+
149
163
  - Initial beta release of V2. V2 is an internal re-write of large parts of the connector to use Databricks edge features. All public APIs from V1 remain.
150
- - Added Unity Catalog support (pass catalog and / or schema key word args to the .connect method to select initial schema and catalog)
164
+ - Added Unity Catalog support (pass catalog and / or schema key word args to the .connect method to select initial schema and catalog)
151
165
 
152
166
  ---
153
167
 
154
168
  **Note**: The code for versions prior to `v2.0.0b` is not contained in this repository. The below entries are included for reference only.
155
169
 
156
170
  ---
171
+
157
172
  ## 1.0.0 (2022-01-20)
173
+
158
174
  - Add operations for retrieving metadata
159
175
  - Add the ability to access columns by name on result rows
160
176
  - Add the ability to provide configuration settings on connect
161
177
 
162
178
  ## 0.9.4 (2022-01-10)
179
+
163
180
  - Improved logging and error messages.
164
181
 
165
182
  ## 0.9.3 (2021-12-08)
183
+
166
184
  - Add retries for 429 and 503 HTTP responses.
167
185
 
168
186
  ## 0.9.2 (2021-12-02)
187
+
169
188
  - (Bug fix) Increased Thrift requirement from 0.10.0 to 0.13.0 as 0.10.0 was in fact incompatible
170
189
  - (Bug fix) Fixed error message after query execution failed -SQLSTATE and Error message were misplaced
171
190
 
172
191
  ## 0.9.1 (2021-09-01)
192
+
173
193
  - Public Preview release, Experimental tag removed
174
194
  - minor updates in internal build/packaging
175
195
  - no functional changes
176
196
 
177
197
  ## 0.9.0 (2021-08-04)
198
+
178
199
  - initial (Experimental) release of pyhive-forked connector
179
200
  - Python DBAPI 2.0 (PEP-0249), thrift based
180
201
  - see docs for more info: https://docs.databricks.com/dev-tools/python-sql-connector.html
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: databricks-sql-connector
3
- Version: 2.9.4b1
3
+ Version: 2.9.6
4
4
  Summary: Databricks SQL Connector for Python
5
5
  License: Apache-2.0
6
6
  Author: Databricks
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "databricks-sql-connector"
3
- version = "2.9.4b1"
3
+ version = "2.9.6"
4
4
  description = "Databricks SQL Connector for Python"
5
5
  authors = ["Databricks <databricks-sql-connector-maintainers@databricks.com>"]
6
6
  license = "Apache-2.0"
@@ -31,8 +31,7 @@ class RedactUrlQueryParamsFilter(logging.Filter):
31
31
  )
32
32
  else:
33
33
  record.args = tuple(
34
- (self.redact(arg) if isinstance(arg, str) else arg)
35
- for arg in record.args
34
+ (self.redact(arg) if isinstance(arg, str) else arg) for arg in record.args
36
35
  )
37
36
 
38
37
  return True
@@ -40,6 +39,7 @@ class RedactUrlQueryParamsFilter(logging.Filter):
40
39
 
41
40
  logging.getLogger("urllib3.connectionpool").addFilter(RedactUrlQueryParamsFilter())
42
41
 
42
+
43
43
  class DBAPITypeObject(object):
44
44
  def __init__(self, *values):
45
45
  self.values = values
@@ -60,7 +60,7 @@ DATETIME = DBAPITypeObject("timestamp")
60
60
  DATE = DBAPITypeObject("date")
61
61
  ROWID = DBAPITypeObject()
62
62
 
63
- __version__ = "2.9.4b1"
63
+ __version__ = "2.9.6"
64
64
  USER_AGENT_NAME = "PyDatabricksSqlConnector"
65
65
 
66
66
  # These two functions are pyhive legacy
@@ -189,10 +189,6 @@ class THttpClient(thrift.transport.THttpClient.THttpClient):
189
189
  self.message = self.__resp.reason
190
190
  self.headers = self.__resp.headers
191
191
 
192
- # Saves the cookie sent by the server response
193
- if "Set-Cookie" in self.headers:
194
- self.setCustomHeaders(dict("Cookie", self.headers["Set-Cookie"]))
195
-
196
192
  @staticmethod
197
193
  def basic_proxy_auth_header(proxy):
198
194
  if proxy is None or not proxy.username:
@@ -10,7 +10,7 @@ from databricks.sql.thrift_api.TCLIService.ttypes import TSparkArrowResultLink
10
10
 
11
11
  logger = logging.getLogger(__name__)
12
12
 
13
- DEFAULT_CLOUD_FILE_TIMEOUT = int(os.getenv("DATABRICKS_CLOUD_FILE_TIMEOUT", 60))
13
+ DEFAULT_CLOUD_FILE_TIMEOUT = int(os.getenv("DATABRICKS_CLOUD_FILE_TIMEOUT", 180))
14
14
 
15
15
 
16
16
  @dataclass
@@ -221,9 +221,11 @@ def http_get_with_retry(url, max_retries=5, backoff_factor=2, download_timeout=6
221
221
  return response
222
222
  else:
223
223
  logger.error(response)
224
- except requests.RequestException as e:
224
+ except Exception as e:
225
225
  # if this is not redacted, it will print the pre-signed URL
226
- logger.error(f"request failed with exception: {re.sub(pattern, mask, str(e))}")
226
+ logger.error(
227
+ f"request failed with exception: {re.sub(pattern, mask, str(e))}"
228
+ )
227
229
  finally:
228
230
  session.close()
229
231
  # Exponential backoff before the next attempt
@@ -353,8 +353,8 @@ class ThriftBackend:
353
353
  # encapsulate retry checks, returns None || delay-in-secs
354
354
  # Retry IFF 429/503 code + Retry-After header set
355
355
  http_code = getattr(self._transport, "code", None)
356
- retry_after = getattr(self._transport, "headers", {}).get("Retry-After")
357
- if http_code in [429, 503] and retry_after:
356
+ retry_after = getattr(self._transport, "headers", {}).get("Retry-After", 1)
357
+ if http_code in [429, 503]:
358
358
  # bound delay (seconds) by [min_delay*1.5^(attempt-1), max_delay]
359
359
  return bound_retry_delay(attempt, int(retry_after))
360
360
  return None
@@ -226,6 +226,9 @@ class CloudFetchQueue(ResultSetQueue):
226
226
  # The server rarely prepares the exact number of rows requested by the client in cloud fetch.
227
227
  # Subsequently, we drop the extraneous rows in the last file if more rows are retrieved than requested
228
228
  if arrow_table.num_rows > downloaded_file.row_count:
229
+ logger.debug(
230
+ f"received {arrow_table.num_rows} rows, expected {downloaded_file.row_count} rows. Dropping extraneous rows."
231
+ )
229
232
  self.start_row_index += downloaded_file.row_count
230
233
  return arrow_table.slice(0, downloaded_file.row_count)
231
234