databricks-sql-connector 4.2.7__tar.gz → 4.3.0__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-4.2.7 → databricks_sql_connector-4.3.0}/CHANGELOG.md +5 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/PKG-INFO +30 -3
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/README.md +24 -0
- databricks_sql_connector-4.3.0/pyproject.toml +135 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/__init__.py +1 -1
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/kernel/_errors.py +57 -6
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/kernel/client.py +330 -176
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/client.py +19 -9
- databricks_sql_connector-4.2.7/pyproject.toml +0 -109
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/LICENSE +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/auth.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/auth_utils.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/authenticators.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/common.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/endpoint.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/oauth.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/oauth_http_handler.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/retry.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/thrift_http_client.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/auth/token_federation.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/databricks_client.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/kernel/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/kernel/auth_bridge.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/kernel/result_set.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/kernel/type_mapping.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/backend.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/models/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/models/base.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/models/requests.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/models/responses.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/queue.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/result_set.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/utils/constants.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/utils/conversion.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/utils/filters.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/utils/http_client.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/sea/utils/normalize.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/thrift_backend.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/types.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/utils/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/backend/utils/guid_utils.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/cloudfetch/download_manager.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/cloudfetch/downloader.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/common/agent.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/common/feature_flag.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/common/http.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/common/http_utils.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/common/unified_http_client.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/common/url_utils.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/exc.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/experimental/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/experimental/oauth_persistence.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/parameters/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/parameters/native.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/parameters/py.typed +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/py.typed +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/result_set.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/session.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/circuit_breaker_manager.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/latency_logger.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/models/endpoint_models.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/models/enums.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/models/event.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/models/frontend_logs.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/telemetry_client.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/telemetry_push_client.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/telemetry/utils.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/thrift_api/TCLIService/TCLIService-remote +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/thrift_api/TCLIService/TCLIService.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/thrift_api/TCLIService/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/thrift_api/TCLIService/constants.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/thrift_api/TCLIService/ttypes.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/thrift_api/__init__.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/types.py +0 -0
- {databricks_sql_connector-4.2.7 → databricks_sql_connector-4.3.0}/src/databricks/sql/utils.py +0 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
# 4.3.0 (2026-06-12)
|
|
4
|
+
- **New: optional Rust kernel backend (`use_kernel=True`).** Adds an alternative connection path backed by the native [`databricks-sql-kernel`](https://pypi.org/project/databricks-sql-kernel/) client (a Rust core exposed via PyO3), installable with the new `databricks-sql-connector[kernel]` extra. The kernel talks to Databricks over the **SEA (Statement Execution API) HTTP transport** — not Thrift — with CloudFetch and inline-Arrow result fetching, so `use_kernel=True` gives you a modern SEA-native client through the same DB-API surface. Supports PAT, OAuth M2M, and OAuth U2M auth. Requires Python >= 3.10 (the kernel wheel is `cp310-abi3`); on older interpreters the extra is a no-op and `use_kernel=True` raises a clear `ImportError`. The default backend remains Thrift — opt in per connection.
|
|
5
|
+
- Kernel backend behavior is aligned with the Thrift backend so application code works the same either way: consistent cursor-state tracking (`query_id` / `get_query_state`), metadata (catalogs/schemas/tables/columns with JDBC-style filter semantics and case-insensitive `table_types`), DML `rowcount`, server-sourced async execution state, sync `cancel()`, fail-loud staging/volume operations, and structured error context (SQLSTATE, diagnostic info). Kernel logs surface through Python `logging` under the `databricks.sql.kernel` logger (databricks/databricks-sql-python#824, #825, #830, #838, #839 by @vikrantpuppala)
|
|
6
|
+
- Revert the thrift 0.23.0 bump that broke installation on DBR LTS (ES-1960554) (databricks/databricks-sql-python#840 by @vikrantpuppala)
|
|
7
|
+
|
|
3
8
|
# 4.2.7 (2026-06-02)
|
|
4
9
|
- Extract SPOG org-id from cluster http_path for non-Thrift requests (databricks/databricks-sql-python#817 by @msrathore-db)
|
|
5
10
|
- Remove empty chunks in CloudFetch concatenation (databricks/databricks-sql-python#814 by @jprakash-db)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: databricks-sql-connector
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.0
|
|
4
4
|
Summary: Databricks SQL Connector for Python
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -16,21 +16,24 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Provides-Extra: kernel
|
|
19
20
|
Provides-Extra: pyarrow
|
|
21
|
+
Requires-Dist: databricks-sql-kernel (>=0.2.0,<0.3.0) ; (python_version >= "3.10") and (extra == "kernel")
|
|
20
22
|
Requires-Dist: lz4 (>=4.0.2,<5.0.0) ; python_version >= "3.8" and python_version < "3.14"
|
|
21
23
|
Requires-Dist: lz4 (>=4.4.5,<5.0.0) ; python_version >= "3.14"
|
|
22
24
|
Requires-Dist: oauthlib (>=3.1.0,<4.0.0)
|
|
23
25
|
Requires-Dist: openpyxl (>=3.0.10,<4.0.0)
|
|
24
26
|
Requires-Dist: pandas (>=1.2.5,<4.0.0) ; python_version >= "3.8" and python_version < "3.13"
|
|
25
27
|
Requires-Dist: pandas (>=2.2.3,<4.0.0) ; python_version >= "3.13"
|
|
26
|
-
Requires-Dist: pyarrow (>=14.0.1) ; (python_version >= "3.
|
|
28
|
+
Requires-Dist: pyarrow (>=14.0.1) ; (python_version >= "3.10" and python_version < "3.13") and (extra == "pyarrow")
|
|
29
|
+
Requires-Dist: pyarrow (>=14.0.1,<23) ; (python_version >= "3.8" and python_version < "3.10") and (extra == "pyarrow")
|
|
27
30
|
Requires-Dist: pyarrow (>=18.0.0) ; (python_version == "3.13") and (extra == "pyarrow")
|
|
28
31
|
Requires-Dist: pyarrow (>=22.0.0) ; (python_version >= "3.14") and (extra == "pyarrow")
|
|
29
32
|
Requires-Dist: pybreaker (>=1.0.0,<2.0.0)
|
|
30
33
|
Requires-Dist: pyjwt (>=2.0.0,<3.0.0)
|
|
31
34
|
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
32
35
|
Requires-Dist: requests (>=2.18.1,<3.0.0)
|
|
33
|
-
Requires-Dist: thrift (>=0.22.0,<0.
|
|
36
|
+
Requires-Dist: thrift (>=0.22.0,<0.23.0)
|
|
34
37
|
Requires-Dist: urllib3 (>=1.26)
|
|
35
38
|
Project-URL: Bug Tracker, https://github.com/databricks/databricks-sql-python/issues
|
|
36
39
|
Project-URL: Homepage, https://github.com/databricks/databricks-sql-python
|
|
@@ -68,6 +71,30 @@ Install using `pip install databricks-sql-connector`
|
|
|
68
71
|
### Installing the core library with PyArrow
|
|
69
72
|
Install using `pip install databricks-sql-connector[pyarrow]`
|
|
70
73
|
|
|
74
|
+
### Installing with the Rust kernel backend (`use_kernel=True`)
|
|
75
|
+
Install using `pip install databricks-sql-connector[kernel]`
|
|
76
|
+
|
|
77
|
+
This adds the optional [`databricks-sql-kernel`](https://pypi.org/project/databricks-sql-kernel/)
|
|
78
|
+
extension (a native Rust client core, exposed via PyO3). Pass
|
|
79
|
+
`use_kernel=True` to `sql.connect(...)` to route the connection through it
|
|
80
|
+
instead of the default Thrift backend:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
connection = sql.connect(
|
|
84
|
+
server_hostname=host,
|
|
85
|
+
http_path=http_path,
|
|
86
|
+
access_token=token,
|
|
87
|
+
use_kernel=True,
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Notes:
|
|
92
|
+
- Requires **Python >= 3.10** (the kernel wheel is published as
|
|
93
|
+
`cp310-abi3`). On older interpreters the `[kernel]` extra installs
|
|
94
|
+
nothing and `use_kernel=True` raises an `ImportError`.
|
|
95
|
+
- The extra also pulls in PyArrow, which the kernel result path requires.
|
|
96
|
+
- Authentication supports PAT (`access_token`), OAuth M2M, and OAuth U2M.
|
|
97
|
+
|
|
71
98
|
|
|
72
99
|
```bash
|
|
73
100
|
export DATABRICKS_HOST=********.databricks.com
|
|
@@ -30,6 +30,30 @@ Install using `pip install databricks-sql-connector`
|
|
|
30
30
|
### Installing the core library with PyArrow
|
|
31
31
|
Install using `pip install databricks-sql-connector[pyarrow]`
|
|
32
32
|
|
|
33
|
+
### Installing with the Rust kernel backend (`use_kernel=True`)
|
|
34
|
+
Install using `pip install databricks-sql-connector[kernel]`
|
|
35
|
+
|
|
36
|
+
This adds the optional [`databricks-sql-kernel`](https://pypi.org/project/databricks-sql-kernel/)
|
|
37
|
+
extension (a native Rust client core, exposed via PyO3). Pass
|
|
38
|
+
`use_kernel=True` to `sql.connect(...)` to route the connection through it
|
|
39
|
+
instead of the default Thrift backend:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
connection = sql.connect(
|
|
43
|
+
server_hostname=host,
|
|
44
|
+
http_path=http_path,
|
|
45
|
+
access_token=token,
|
|
46
|
+
use_kernel=True,
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Notes:
|
|
51
|
+
- Requires **Python >= 3.10** (the kernel wheel is published as
|
|
52
|
+
`cp310-abi3`). On older interpreters the `[kernel]` extra installs
|
|
53
|
+
nothing and `use_kernel=True` raises an `ImportError`.
|
|
54
|
+
- The extra also pulls in PyArrow, which the kernel result path requires.
|
|
55
|
+
- Authentication supports PAT (`access_token`), OAuth M2M, and OAuth U2M.
|
|
56
|
+
|
|
33
57
|
|
|
34
58
|
```bash
|
|
35
59
|
export DATABRICKS_HOST=********.databricks.com
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "databricks-sql-connector"
|
|
3
|
+
version = "4.3.0"
|
|
4
|
+
description = "Databricks SQL Connector for Python"
|
|
5
|
+
authors = ["Databricks <databricks-sql-connector-maintainers@databricks.com>"]
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
packages = [{ include = "databricks", from = "src" }]
|
|
9
|
+
include = ["CHANGELOG.md"]
|
|
10
|
+
|
|
11
|
+
[tool.poetry.dependencies]
|
|
12
|
+
python = "^3.8.0"
|
|
13
|
+
thrift = "~=0.22.0"
|
|
14
|
+
pandas = [
|
|
15
|
+
{ version = ">=1.2.5,<4.0.0", python = ">=3.8,<3.13" },
|
|
16
|
+
{ version = ">=2.2.3,<4.0.0", python = ">=3.13" }
|
|
17
|
+
]
|
|
18
|
+
lz4 = [
|
|
19
|
+
{ version = "^4.0.2", python = ">=3.8,<3.14" },
|
|
20
|
+
{ version = "^4.4.5", python = ">=3.14" }
|
|
21
|
+
]
|
|
22
|
+
requests = "^2.18.1"
|
|
23
|
+
oauthlib = "^3.1.0"
|
|
24
|
+
openpyxl = "^3.0.10"
|
|
25
|
+
urllib3 = ">=1.26"
|
|
26
|
+
python-dateutil = "^2.8.0"
|
|
27
|
+
pyarrow = [
|
|
28
|
+
# The <3.10 band is capped at <23 because pyarrow>=23 dropped
|
|
29
|
+
# Python 3.9 (it requires >=3.10). Without the cap, poetry tries to
|
|
30
|
+
# unify this entry with the kernel's transitive pyarrow>=23.0.1,<24
|
|
31
|
+
# across the 3.8–3.10 slice and `poetry lock` fails ("pyarrow is
|
|
32
|
+
# forbidden"). The cap removes no installable version — the newest
|
|
33
|
+
# pyarrow with a 3.9 wheel is 21.x — it just makes that explicit to
|
|
34
|
+
# the solver so the optional [kernel] extra (python>=3.10) can
|
|
35
|
+
# coexist. See the kernel dep + [kernel] extra below.
|
|
36
|
+
{ version = ">=14.0.1,<23", python = ">=3.8,<3.10", optional=true },
|
|
37
|
+
{ version = ">=14.0.1", python = ">=3.10,<3.13", optional=true },
|
|
38
|
+
{ version = ">=18.0.0", python = ">=3.13,<3.14", optional=true },
|
|
39
|
+
{ version = ">=22.0.0", python = ">=3.14", optional=true }
|
|
40
|
+
]
|
|
41
|
+
pyjwt = "^2.0.0"
|
|
42
|
+
pybreaker = "^1.0.0"
|
|
43
|
+
requests-kerberos = {version = "^0.15.0", optional = true}
|
|
44
|
+
# Optional Rust kernel backend for ``use_kernel=True`` (PyO3 wheel).
|
|
45
|
+
# Pulled in only via the ``[kernel]`` extra below. The published wheel
|
|
46
|
+
# is ``abi3`` with ``Requires-Python: >=3.10`` (built ``abi3-py310``),
|
|
47
|
+
# so the dependency is gated to Python >= 3.10: on 3.8/3.9 the
|
|
48
|
+
# ``[kernel]`` extra resolves to nothing and ``use_kernel=True`` raises
|
|
49
|
+
# a clear ImportError at runtime (see backend/kernel/_errors.py).
|
|
50
|
+
#
|
|
51
|
+
# Floor is 0.2.0 (``^0.2.0`` == ``>=0.2.0,<0.3.0``). The kernel is
|
|
52
|
+
# pre-1.0, so each 0.x minor may carry breaking changes — the ``<0.3.0``
|
|
53
|
+
# cap means we bump this deliberately when the kernel ships 0.3.0 rather
|
|
54
|
+
# than letting a potentially-breaking minor flow in automatically. 0.2.0
|
|
55
|
+
# keeps the same Requires-Python (>=3.10) and pyarrow (>=23.0.1,<24) pin
|
|
56
|
+
# as 0.1.x, so the gating below is unchanged.
|
|
57
|
+
databricks-sql-kernel = {version = "^0.2.0", optional = true, python = ">=3.10"}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
[tool.poetry.extras]
|
|
61
|
+
pyarrow = ["pyarrow"]
|
|
62
|
+
# ``pip install databricks-sql-connector[kernel]`` adds the Rust kernel
|
|
63
|
+
# backend so ``use_kernel=True`` works. No-op on Python < 3.10 (the
|
|
64
|
+
# wheel's floor) — those users get a runtime ImportError if they pass
|
|
65
|
+
# ``use_kernel=True``.
|
|
66
|
+
#
|
|
67
|
+
# The kernel result path (``backend/kernel/result_set.py``) needs
|
|
68
|
+
# pyarrow, but it is NOT listed in this extra on purpose: the published
|
|
69
|
+
# kernel wheel declares ``pyarrow>=23.0.1,<24`` as a hard runtime
|
|
70
|
+
# dependency, so ``pip install ...[kernel]`` already pulls a compatible
|
|
71
|
+
# pyarrow transitively. Listing bare ``pyarrow`` here additionally
|
|
72
|
+
# forces poetry to co-resolve an unconstrained pyarrow against the
|
|
73
|
+
# kernel's ``>=23.0.1,<24`` (which itself requires Python >=3.10) across
|
|
74
|
+
# the connector's full 3.8–3.14 support matrix, which is unsatisfiable
|
|
75
|
+
# on 3.8/3.9 and breaks ``poetry lock``. The kernel's own dependency
|
|
76
|
+
# metadata is the single source of truth for the pyarrow floor.
|
|
77
|
+
kernel = ["databricks-sql-kernel"]
|
|
78
|
+
|
|
79
|
+
[tool.poetry.group.dev.dependencies]
|
|
80
|
+
pytest = "^7.1.2"
|
|
81
|
+
mypy = "^1.10.1"
|
|
82
|
+
pylint = ">=2.12.0"
|
|
83
|
+
black = "^22.3.0"
|
|
84
|
+
pytest-dotenv = "^0.5.2"
|
|
85
|
+
pytest-cov = "^4.0.0"
|
|
86
|
+
pytest-xdist = "^3.0.0"
|
|
87
|
+
numpy = [
|
|
88
|
+
{ version = ">=1.16.6", python = ">=3.8,<3.11" },
|
|
89
|
+
{ version = ">=1.23.4", python = ">=3.11" },
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[tool.poetry.urls]
|
|
93
|
+
"Homepage" = "https://github.com/databricks/databricks-sql-python"
|
|
94
|
+
"Bug Tracker" = "https://github.com/databricks/databricks-sql-python/issues"
|
|
95
|
+
|
|
96
|
+
[build-system]
|
|
97
|
+
requires = ["poetry-core>=1.0.0"]
|
|
98
|
+
build-backend = "poetry.core.masonry.api"
|
|
99
|
+
|
|
100
|
+
[tool.mypy]
|
|
101
|
+
ignore_missing_imports = "true"
|
|
102
|
+
exclude = ['ttypes\.py$', 'TCLIService\.py$']
|
|
103
|
+
|
|
104
|
+
[tool.black]
|
|
105
|
+
exclude = '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist|thrift_api)/'
|
|
106
|
+
|
|
107
|
+
[tool.pytest.ini_options]
|
|
108
|
+
markers = [
|
|
109
|
+
"reviewed: Test case has been reviewed by Databricks",
|
|
110
|
+
"serial: Tests that must run serially (not parallelized)",
|
|
111
|
+
"realkernel: Requires the real databricks-sql-kernel wheel and an unpolluted sys.modules (no fake kernel stub); must run in a separate pytest invocation from tests that fake databricks_sql_kernel (deselect with -m 'not realkernel', run alone with -m realkernel).",
|
|
112
|
+
]
|
|
113
|
+
minversion = "6.0"
|
|
114
|
+
log_cli = "false"
|
|
115
|
+
log_cli_level = "INFO"
|
|
116
|
+
testpaths = ["tests"]
|
|
117
|
+
env_files = ["test.env"]
|
|
118
|
+
|
|
119
|
+
[tool.coverage.run]
|
|
120
|
+
source = ["src"]
|
|
121
|
+
branch = true
|
|
122
|
+
omit = [
|
|
123
|
+
"*/tests/*",
|
|
124
|
+
"*/test_*",
|
|
125
|
+
"*/__pycache__/*",
|
|
126
|
+
"*/thrift_api/*",
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
[tool.coverage.report]
|
|
130
|
+
precision = 2
|
|
131
|
+
show_missing = true
|
|
132
|
+
skip_covered = false
|
|
133
|
+
|
|
134
|
+
[tool.coverage.xml]
|
|
135
|
+
output = "coverage.xml"
|
|
@@ -38,6 +38,8 @@ flow is visible at the call site, the helper is a pure function
|
|
|
38
38
|
|
|
39
39
|
from __future__ import annotations
|
|
40
40
|
|
|
41
|
+
import logging
|
|
42
|
+
|
|
41
43
|
from databricks.sql.exc import (
|
|
42
44
|
DatabaseError,
|
|
43
45
|
Error,
|
|
@@ -50,13 +52,40 @@ try:
|
|
|
50
52
|
import databricks_sql_kernel as _kernel # type: ignore[import-not-found]
|
|
51
53
|
except ImportError as exc: # pragma: no cover - same hint as client.py
|
|
52
54
|
raise ImportError(
|
|
53
|
-
"use_kernel=True requires the databricks-sql-kernel
|
|
54
|
-
"is not
|
|
55
|
-
"databricks-sql-kernel
|
|
56
|
-
"
|
|
57
|
-
"
|
|
55
|
+
"use_kernel=True requires the optional databricks-sql-kernel "
|
|
56
|
+
"extension, which is not installed. Install it with:\n"
|
|
57
|
+
' pip install "databricks-sql-connector[kernel]"\n'
|
|
58
|
+
"The kernel wheel requires Python >= 3.10; on older interpreters "
|
|
59
|
+
"use_kernel is unavailable. For local kernel development you can "
|
|
60
|
+
"instead build it from the databricks-sql-kernel repo:\n"
|
|
61
|
+
" cd databricks-sql-kernel/pyo3 && maturin develop --release"
|
|
58
62
|
) from exc
|
|
59
63
|
|
|
64
|
+
# Route the kernel's Rust-side logs into Python's ``logging`` as soon as
|
|
65
|
+
# the extension loads. The kernel emits under the ``databricks.sql.kernel``
|
|
66
|
+
# logger (a child of the connector's ``databricks.sql`` namespace), so a
|
|
67
|
+
# customer who configures ``databricks.sql`` logging gets kernel logs for
|
|
68
|
+
# free with no extra setup.
|
|
69
|
+
#
|
|
70
|
+
# This is a best-effort, non-essential feature: it must never take down
|
|
71
|
+
# ``use_kernel=True`` for a process. ``getattr`` guards against an older
|
|
72
|
+
# kernel wheel that predates the function. The ``try`` guards against the
|
|
73
|
+
# call itself throwing — note ``except BaseException`` is deliberate: a
|
|
74
|
+
# panic raised across the PyO3 boundary surfaces as
|
|
75
|
+
# ``pyo3_runtime.PanicException``, which derives from ``BaseException``
|
|
76
|
+
# (not ``Exception``), so a narrower clause would let it escape module
|
|
77
|
+
# import and fail every kernel-backed connection. The kernel side is
|
|
78
|
+
# idempotent and returns rather than panics on a double install, but we
|
|
79
|
+
# do not rely on that here — the guard holds regardless of the Rust impl.
|
|
80
|
+
_kernel_init_logging = getattr(_kernel, "init_logging", None)
|
|
81
|
+
if _kernel_init_logging is not None:
|
|
82
|
+
try:
|
|
83
|
+
_kernel_init_logging()
|
|
84
|
+
except BaseException as exc: # noqa: BLE001 - see comment above re: PanicException
|
|
85
|
+
logging.getLogger(__name__).debug(
|
|
86
|
+
"kernel log bridge init failed; continuing without it: %r", exc
|
|
87
|
+
)
|
|
88
|
+
|
|
60
89
|
|
|
61
90
|
# Map a kernel `code` slug to the PEP 249 exception class that best
|
|
62
91
|
# captures it. The match isn't a perfect 1:1 — PEP 249 has a
|
|
@@ -97,7 +126,23 @@ def reraise_kernel_error(exc: "_kernel.KernelError") -> "Error":
|
|
|
97
126
|
"""
|
|
98
127
|
code = getattr(exc, "code", "Unknown")
|
|
99
128
|
cls = _CODE_TO_EXCEPTION.get(code, DatabaseError)
|
|
100
|
-
|
|
129
|
+
|
|
130
|
+
# For ServerOperationError, reproduce the Thrift backend's
|
|
131
|
+
# ``context`` dict so callers that read
|
|
132
|
+
# ``err.context["diagnostic-info"]`` (the Spark stack trace) /
|
|
133
|
+
# ``err.context["operation-id"]`` get the same shape on the kernel
|
|
134
|
+
# path. ``diagnostic_info`` is forwarded from the kernel error (it
|
|
135
|
+
# now crosses the PyO3 boundary; older wheels return ``None`` via
|
|
136
|
+
# ``getattr``, so this degrades gracefully). Matches
|
|
137
|
+
# thrift_backend.py's ServerOperationError construction.
|
|
138
|
+
context = None
|
|
139
|
+
if cls is ServerOperationError:
|
|
140
|
+
context = {
|
|
141
|
+
"operation-id": getattr(exc, "query_id", None),
|
|
142
|
+
"diagnostic-info": getattr(exc, "diagnostic_info", None),
|
|
143
|
+
}
|
|
144
|
+
new = cls(getattr(exc, "message", str(exc)), context)
|
|
145
|
+
|
|
101
146
|
for attr in (
|
|
102
147
|
"code",
|
|
103
148
|
"sql_state",
|
|
@@ -106,6 +151,12 @@ def reraise_kernel_error(exc: "_kernel.KernelError") -> "Error":
|
|
|
106
151
|
"http_status",
|
|
107
152
|
"retryable",
|
|
108
153
|
"query_id",
|
|
154
|
+
# Extended server status now forwarded across the PyO3 boundary
|
|
155
|
+
# (kernel #121). ``getattr(..., None)`` keeps this forward-safe
|
|
156
|
+
# against an older wheel that doesn't set these attrs.
|
|
157
|
+
"display_message",
|
|
158
|
+
"diagnostic_info",
|
|
159
|
+
"error_details_json",
|
|
109
160
|
):
|
|
110
161
|
setattr(new, attr, getattr(exc, attr, None))
|
|
111
162
|
return new
|