Skip to content

Commit 904c304

Browse files
jprakash-dbjackyhu-db
authored andcommitted
PySQL Connector split into connector and sqlalchemy (#444)
* Modified the gitignore file to not have .idea file * [PECO-1803] Splitting the PySql connector into the core and the non core part (#417) * Implemented ColumnQueue to test the fetchall without pyarrow Removed token removed token * order of fields in row corrected * Changed the folder structure and tested the basic setup to work * Refractored the code to make connector to work * Basic Setup of connector, core and sqlalchemy is working * Basic integration of core, connect and sqlalchemy is working * Setup working dynamic change from ColumnQueue to ArrowQueue * Refractored the test code and moved to respective folders * Added the unit test for column_queue Fixed __version__ Fix * venv_main added to git ignore * Added code for merging columnar table * Merging code for columnar * Fixed the retry_close sesssion test issue with logging * Fixed the databricks_sqlalchemy tests and introduced pytest.ini for the sqla_testing * Added pyarrow_test mark on pytest * Fixed databricks.sqlalchemy to databricks_sqlalchemy imports * Added poetry.lock * Added dist folder * Changed the pyproject.toml * Minor Fix * Added the pyarrow skip tag on unit tests and tested their working * Fixed the Decimal and timestamp conversion issue in non arrow pipeline * Removed not required files and reformatted * Fixed test_retry error * Changed the folder structure to src / databricks * Removed the columnar non arrow flow to another PR * Moved the README to the root * removed columnQueue instance * Revmoved databricks_sqlalchemy dependency in core * Changed the pysql_supports_arrow predicate, introduced changes in the pyproject.toml * Ran the black formatter with the original version * Extra .py removed from all the __init__.py files names * Undo formatting check * Check * Check * Check * Check * Check * Check * Check * Check * Check * Check * Check * Check * Check * Check * BIG UPDATE * Refeactor code * Refractor * Fixed versioning * Minor refractoring * Minor refractoring * Changed the folder structure such that sqlalchemy has not reference here * Fixed README.md and CONTRIBUTING.md * Added manual publish * On push trigger added * Manually setting the publish step * Changed versioning in pyproject.toml * Bumped up the version to 4.0.0.b3 and also changed the structure to have pyarrow as optional * Removed the sqlalchemy tests from integration.yml file * [PECO-1803] Print warning message if pyarrow is not installed (#468) Print warning message if pyarrow is not installed Signed-off-by: Jacky Hu <jacky.hu@databricks.com> * [PECO-1803] Remove sqlalchemy and update README.md (#469) Remove sqlalchemy and update README.md Signed-off-by: Jacky Hu <jacky.hu@databricks.com> * Removed all sqlalchemy related stuff * generated the lock file * Fixed failing tests * removed poetry.lock * Updated the lock file * Fixed poetry numpy 2.2.2 issue * Workflow fixes --------- Signed-off-by: Jacky Hu <jacky.hu@databricks.com> Co-authored-by: Jacky Hu <jacky.hu@databricks.com> Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 6361e85 commit 904c304

File tree

9 files changed

+164
-250
lines changed

9 files changed

+164
-250
lines changed

.github/workflows/code-quality-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
runs-on: ubuntu-latest
6767
strategy:
6868
matrix:
69-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
69+
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
7070
steps:
7171
#----------------------------------------------
7272
# check-out repo and set-up python
@@ -93,7 +93,7 @@ jobs:
9393
#----------------------------------------------
9494
- name: Load cached venv
9595
id: cached-poetry-dependencies
96-
uses: actions/cache@v4
96+
uses: actions/cache@v2
9797
with:
9898
path: .venv-pyarrow
9999
key: venv-pyarrow-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}

CHANGELOG.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,10 @@
11
# Release History
22

3-
# 4.0.3 (2025-04-22)
4-
5-
- Fix: Removed `packaging` dependency in favour of default libraries, for `urllib3` version checks (databricks/databricks-sql-python#547 by @jprakash-db)
6-
-
7-
# 4.0.2 (2025-04-01)
8-
9-
- Fix: Relaxed the pin for `python-dateutil` to be `^2.8.0` (databricks/databricks-sql-python#538 by @jprakash-db)
10-
11-
# 4.0.1 (2025-03-19)
12-
13-
**Note: this release was yanked from Pypi on 19 March 2025 due to compatibility issues with `dbt-databricks<1.5.3`**
14-
15-
- Support for multiple timestamp formats parsing (databricks/databricks-sql-python#533 by @jprakash-db)
16-
- Rename `_user_agent_entry` in connect call to `user_agent_entry` to expose it as a public parameter. (databricks/databricks-sql-python#530 by @shivam2680)
17-
- Fix: compatibility with urllib3 versions less than 2.x. (databricks/databricks-sql-python#526 by @shivam2680)
18-
- Support for Python 3.13 and updated dependencies (databricks/databricks-sql-python#510 by @dhirschfeld and @dbaxa)
19-
20-
# 4.0.0 (2025-01-19)
3+
# 4.0.0 (TBD)
214

225
- Split the connector into two separate packages: `databricks-sql-connector` and `databricks-sqlalchemy`. The `databricks-sql-connector` package contains the core functionality of the connector, while the `databricks-sqlalchemy` package contains the SQLAlchemy dialect for the connector.
236
- Pyarrow dependency is now optional in `databricks-sql-connector`. Users needing arrow are supposed to explicitly install pyarrow
247

25-
# 3.7.3 (2025-03-28)
26-
27-
- Fix: Unable to poll small results in execute_async function (databricks/databricks-sql-python#515 by @jprakash-db)
28-
- Updated log messages to show the status code and error messages of requests (databricks/databricks-sql-python#511 by @jprakash-db)
29-
- Fix: Incorrect metadata was fetched in case of queries with the same alias (databricks/databricks-sql-python#505 by @jprakash-db)
30-
31-
# 3.7.2 (2025-01-31)
32-
33-
- Updated the retry_dela_max and retry_timeout (databricks/databricks-sql-python#497 by @jprakash-db)
34-
35-
# 3.7.1 (2025-01-07)
36-
37-
- Relaxed the number of Http retry attempts (databricks/databricks-sql-python#486 by @jprakash-db)
38-
398
# 3.7.0 (2024-12-23)
409

4110
- Fix: Incorrect number of rows fetched in inline results when fetching results with FETCH_NEXT orientation (databricks/databricks-sql-python#479 by @jprakash-db)

poetry.lock

Lines changed: 151 additions & 198 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databricks-sql-connector"
3-
version = "4.0.3"
3+
version = "4.0.0"
44
description = "Databricks SQL Connector for Python"
55
authors = ["Databricks <databricks-sql-connector-maintainers@databricks.com>"]
66
license = "Apache-2.0"
@@ -18,13 +18,13 @@ pandas = [
1818
lz4 = "^4.0.2"
1919
requests = "^2.18.1"
2020
oauthlib = "^3.1.0"
21+
numpy = [
22+
{ version = "^1.16.6", python = ">=3.8,<3.11" },
23+
{ version = "^1.23.4", python = ">=3.11" },
24+
]
2125
openpyxl = "^3.0.10"
2226
urllib3 = ">=1.26"
23-
pyarrow = [
24-
{ version = ">=14.0.1", python = ">=3.8,<3.13", optional=true },
25-
{ version = ">=18.0.0", python = ">=3.13", optional=true }
26-
]
27-
python-dateutil = "^2.8.0"
27+
pyarrow = { version = ">=14.0.1", optional=true }
2828

2929
[tool.poetry.extras]
3030
pyarrow = ["pyarrow"]

tests/unit/test_arrow_queue.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import unittest
22
import pytest
3-
43
try:
54
import pyarrow as pa
65
except ImportError:
76
pa = None
87
from databricks.sql.utils import ArrowQueue
98

10-
119
@pytest.mark.skipif(pa is None, reason="PyArrow is not installed")
1210
class ArrowQueueSuite(unittest.TestCase):
1311
@staticmethod

tests/unit/test_cloud_fetch_queue.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import databricks.sql.utils as utils
1111
from databricks.sql.types import SSLOptions
1212

13-
1413
@pytest.mark.skipif(pyarrow is None, reason="PyArrow is not installed")
1514
class CloudFetchQueueSuite(unittest.TestCase):
1615
def create_result_link(

tests/unit/test_fetches.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
try:
66
import pyarrow as pa
77
except ImportError:
8-
pa = None
8+
pa=None
99

1010
import databricks.sql.client as client
1111
from databricks.sql.utils import ExecuteResponse, ArrowQueue
1212
from databricks.sql.backend.thrift_backend import ThriftDatabricksClient
1313
from databricks.sql.result_set import ThriftResultSet
1414

15-
1615
@pytest.mark.skipif(pa is None, reason="PyArrow is not installed")
1716
class FetchTests(unittest.TestCase):
1817
"""

tests/unit/test_fetches_bench.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import unittest
22
from unittest.mock import Mock
3-
43
try:
54
import pyarrow as pa
65
except ImportError:
7-
pa = None
6+
pa=None
87
import uuid
98
import time
109
import pytest
1110

1211
import databricks.sql.client as client
1312
from databricks.sql.utils import ExecuteResponse, ArrowQueue
1413

15-
1614
@pytest.mark.skipif(pa is None, reason="PyArrow is not installed")
1715
class FetchBenchmarkTests(unittest.TestCase):
1816
"""

tests/unit/test_thrift_backend.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
from unittest.mock import patch, MagicMock, Mock
77
from ssl import CERT_NONE, CERT_REQUIRED
88
from urllib3 import HTTPSConnectionPool
9-
109
try:
1110
import pyarrow
1211
except ImportError:
13-
pyarrow = None
12+
pyarrow=None
1413
import databricks.sql
1514
from databricks.sql import utils
1615
from databricks.sql.types import SSLOptions
@@ -30,8 +29,7 @@ def retry_policy_factory():
3029
"_retry_delay_default": (float, 5, 1, 60),
3130
}
3231

33-
34-
@pytest.mark.skipif(pyarrow is None, reason="PyArrow is not installed")
32+
@pytest.mark.skipif(pyarrow is None,reason="PyArrow is not installed")
3533
class ThriftBackendTestSuite(unittest.TestCase):
3634
okay_status = ttypes.TStatus(statusCode=ttypes.TStatusCode.SUCCESS_STATUS)
3735

0 commit comments

Comments
 (0)