databricks-sql-connector 3.1.0__tar.gz → 3.1.2__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.
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/CHANGELOG.md +11 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/PKG-INFO +1 -1
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/pyproject.toml +1 -1
- {databricks_sql_connector-3.1.0/src/databricks/sql/parameters → databricks_sql_connector-3.1.2/src/databricks}/py.typed +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/__init__.py +8 -2
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/retry.py +6 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/thrift_http_client.py +0 -4
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/client.py +18 -2
- databricks_sql_connector-3.1.2/src/databricks/sql/thrift_api/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/thrift_backend.py +2 -2
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/base.py +1 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/LICENSE +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/README.md +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/auth.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/authenticators.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/endpoint.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/oauth.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/oauth_http_handler.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/cloudfetch/download_manager.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/cloudfetch/downloader.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/exc.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/experimental/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/experimental/oauth_persistence.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/parameters/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/parameters/native.py +0 -0
- /databricks_sql_connector-3.1.0/src/databricks/sql/thrift_api/__init__.py → /databricks_sql_connector-3.1.2/src/databricks/sql/parameters/py.typed +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/thrift_api/TCLIService/TCLIService-remote +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/thrift_api/TCLIService/TCLIService.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/thrift_api/TCLIService/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/thrift_api/TCLIService/constants.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/thrift_api/TCLIService/ttypes.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/types.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/utils.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/README.sqlalchemy.md +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/README.tests.md +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/_ddl.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/_parse.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/_types.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/requirements.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/setup.cfg +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/_extra.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/_future.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/_regression.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/_unsupported.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/conftest.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/overrides/_componentreflectiontest.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/overrides/_ctetest.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test/test_suite.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/__init__.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/conftest.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/e2e/MOCK_DATA.xlsx +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/e2e/test_basic.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/test_ddl.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/test_parsing.py +0 -0
- {databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/test_local/test_types.py +0 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
# 3.1.2 (2024-04-18)
|
|
4
|
+
|
|
5
|
+
- Remove broken cookie code (#379)
|
|
6
|
+
- Small typing fixes (#382, #384 thanks @wyattscarpenter)
|
|
7
|
+
|
|
8
|
+
# 3.1.1 (2024-03-19)
|
|
9
|
+
|
|
10
|
+
- Don't retry requests that fail with code 403 (#373)
|
|
11
|
+
- Assume a default retry-after for 429/503 (#371)
|
|
12
|
+
- Fix boolean literals (#357)
|
|
13
|
+
|
|
3
14
|
# 3.1.0 (2024-02-16)
|
|
4
15
|
|
|
5
16
|
- Revert retry-after behavior to be exponential backoff (#349)
|
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/__init__.py
RENAMED
|
@@ -10,6 +10,12 @@ paramstyle = "named"
|
|
|
10
10
|
|
|
11
11
|
import re
|
|
12
12
|
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
# Use this import purely for type annotations, a la https://mypy.readthedocs.io/en/latest/runtime_troubles.html#import-cycles
|
|
17
|
+
from .client import Connection
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
class RedactUrlQueryParamsFilter(logging.Filter):
|
|
15
21
|
pattern = re.compile(r"(\?|&)([\w-]+)=([^&]+)")
|
|
@@ -62,7 +68,7 @@ DATETIME = DBAPITypeObject("timestamp")
|
|
|
62
68
|
DATE = DBAPITypeObject("date")
|
|
63
69
|
ROWID = DBAPITypeObject()
|
|
64
70
|
|
|
65
|
-
__version__ = "3.1.
|
|
71
|
+
__version__ = "3.1.2"
|
|
66
72
|
USER_AGENT_NAME = "PyDatabricksSqlConnector"
|
|
67
73
|
|
|
68
74
|
# These two functions are pyhive legacy
|
|
@@ -78,7 +84,7 @@ def TimestampFromTicks(ticks):
|
|
|
78
84
|
return Timestamp(*time.localtime(ticks)[:6])
|
|
79
85
|
|
|
80
86
|
|
|
81
|
-
def connect(server_hostname, http_path, access_token=None, **kwargs):
|
|
87
|
+
def connect(server_hostname, http_path, access_token=None, **kwargs) -> "Connection":
|
|
82
88
|
from .client import Connection
|
|
83
89
|
|
|
84
90
|
return Connection(server_hostname, http_path, access_token, **kwargs)
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/retry.py
RENAMED
|
@@ -325,6 +325,7 @@ class DatabricksRetryPolicy(Retry):
|
|
|
325
325
|
default, this means ExecuteStatement is only retried for codes 429 and 503.
|
|
326
326
|
This limit prevents automatically retrying non-idempotent commands that could
|
|
327
327
|
be destructive.
|
|
328
|
+
5. The request received a 403 response, because this can never succeed.
|
|
328
329
|
|
|
329
330
|
|
|
330
331
|
Q: What about OSErrors and Redirects?
|
|
@@ -338,6 +339,11 @@ class DatabricksRetryPolicy(Retry):
|
|
|
338
339
|
if status_code == 200:
|
|
339
340
|
return False, "200 codes are not retried"
|
|
340
341
|
|
|
342
|
+
if status_code == 403:
|
|
343
|
+
raise NonRecoverableNetworkError(
|
|
344
|
+
"Received 403 - FORBIDDEN. Confirm your authentication credentials."
|
|
345
|
+
)
|
|
346
|
+
|
|
341
347
|
# Request failed and server said NotImplemented. This isn't recoverable. Don't retry.
|
|
342
348
|
if status_code == 501:
|
|
343
349
|
raise NonRecoverableNetworkError("Received code 501 from server.")
|
|
@@ -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:
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/client.py
RENAMED
|
@@ -6,6 +6,7 @@ import requests
|
|
|
6
6
|
import json
|
|
7
7
|
import os
|
|
8
8
|
import decimal
|
|
9
|
+
from uuid import UUID
|
|
9
10
|
|
|
10
11
|
from databricks.sql import __version__
|
|
11
12
|
from databricks.sql import *
|
|
@@ -270,7 +271,8 @@ class Connection:
|
|
|
270
271
|
|
|
271
272
|
return value
|
|
272
273
|
|
|
273
|
-
|
|
274
|
+
# The ideal return type for this method is perhaps Self, but that was not added until 3.11, and we support pre-3.11 pythons, currently.
|
|
275
|
+
def __enter__(self) -> "Connection":
|
|
274
276
|
return self
|
|
275
277
|
|
|
276
278
|
def __exit__(self, exc_type, exc_value, traceback):
|
|
@@ -408,7 +410,8 @@ class Cursor:
|
|
|
408
410
|
self.escaper = ParamEscaper()
|
|
409
411
|
self.lastrowid = None
|
|
410
412
|
|
|
411
|
-
|
|
413
|
+
# The ideal return type for this method is perhaps Self, but that was not added until 3.11, and we support pre-3.11 pythons, currently.
|
|
414
|
+
def __enter__(self) -> "Cursor":
|
|
412
415
|
return self
|
|
413
416
|
|
|
414
417
|
def __exit__(self, exc_type, exc_value, traceback):
|
|
@@ -1004,9 +1007,22 @@ class Cursor:
|
|
|
1004
1007
|
def close(self) -> None:
|
|
1005
1008
|
"""Close cursor"""
|
|
1006
1009
|
self.open = False
|
|
1010
|
+
self.active_op_handle = None
|
|
1007
1011
|
if self.active_result_set:
|
|
1008
1012
|
self._close_and_clear_active_result_set()
|
|
1009
1013
|
|
|
1014
|
+
@property
|
|
1015
|
+
def query_id(self) -> Optional[str]:
|
|
1016
|
+
"""
|
|
1017
|
+
This attribute is an identifier of last executed query.
|
|
1018
|
+
|
|
1019
|
+
This attribute will be ``None`` if the cursor has not had an operation
|
|
1020
|
+
invoked via the execute method yet, or if cursor was closed.
|
|
1021
|
+
"""
|
|
1022
|
+
if self.active_op_handle is not None:
|
|
1023
|
+
return str(UUID(bytes=self.active_op_handle.operationId.guid))
|
|
1024
|
+
return None
|
|
1025
|
+
|
|
1010
1026
|
@property
|
|
1011
1027
|
def description(self) -> Optional[List[Tuple]]:
|
|
1012
1028
|
"""
|
|
File without changes
|
|
@@ -376,8 +376,8 @@ class ThriftBackend:
|
|
|
376
376
|
# encapsulate retry checks, returns None || delay-in-secs
|
|
377
377
|
# Retry IFF 429/503 code + Retry-After header set
|
|
378
378
|
http_code = getattr(self._transport, "code", None)
|
|
379
|
-
retry_after = getattr(self._transport, "headers", {}).get("Retry-After")
|
|
380
|
-
if http_code in [429, 503]
|
|
379
|
+
retry_after = getattr(self._transport, "headers", {}).get("Retry-After", 1)
|
|
380
|
+
if http_code in [429, 503]:
|
|
381
381
|
# bound delay (seconds) by [min_delay*1.5^(attempt-1), max_delay]
|
|
382
382
|
return bound_retry_delay(attempt, int(retry_after))
|
|
383
383
|
return None
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/base.py
RENAMED
|
@@ -64,6 +64,7 @@ class DatabricksDialect(default.DefaultDialect):
|
|
|
64
64
|
supports_default_values: bool = False
|
|
65
65
|
supports_server_side_cursors: bool = False
|
|
66
66
|
supports_sequences: bool = False
|
|
67
|
+
supports_native_boolean: bool = True
|
|
67
68
|
|
|
68
69
|
colspecs = {
|
|
69
70
|
sqlalchemy.types.DateTime: dialect_type_impl.TIMESTAMP_NTZ,
|
|
File without changes
|
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/auth/oauth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/types.py
RENAMED
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sql/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{databricks_sql_connector-3.1.0 → databricks_sql_connector-3.1.2}/src/databricks/sqlalchemy/_ddl.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|