Skip to content

Commit

Permalink
feat/add adbc adapter (#519)
Browse files Browse the repository at this point in the history
* Add ADBC Adapter

* fix: lock deps without numpy update

* fix: remove unused type-ignores for mypy 1.9

* fix: pin numpy

* fix: update poetry version in CI

* fix: force py3.9 for harlequin-databricks

* fix: add more robust numpy pin

---------

Co-authored-by: Tyler Hillery <[email protected]>
  • Loading branch information
tconbeer and TylerHillery authored Apr 16, 2024
1 parent 4bc3172 commit ce6fd0e
Show file tree
Hide file tree
Showing 10 changed files with 784 additions and 628 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.2.2
version: 1.7.1
- name: Configure poetry
run: poetry config --no-interaction pypi-token.pypi ${{ secrets.HARLEQUIN_PYPI_TOKEN }}
- name: Get harlequin Version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.2.2
version: 1.7.1
- name: Create release branch
run: |
git checkout -b release/v${{ github.event.inputs.newVersion }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
version: 1.7.1
- name: Install python dependencies
run: poetry install --sync --no-interaction --only main,test
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ All notable changes to this project will be documented in this file.
### Features

- A new `HarlequinConnection.close()` method can be implemented by adapters to gracefully close database connections when the application exits.
- The ADBC adapter is now installable as an extra; use `pip install harlequin[adbc]`.

### Bug Fixes

- Wrong link on text_area_clipboard_error error message ([#509](https://github.com/tconbeer/harlequin/issues/509))
- Fixes broken link on clipboard error message ([#509](https://github.com/tconbeer/harlequin/issues/509))

## [1.16.2] - 2024-03-29

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.PHONY: check
check:
black .
ruff . --fix
ruff check . --fix
pytest -m "not online"
mypy

.PHONY: lint
lint:
black .
ruff . --fix
ruff check . --fix
mypy

.PHONY: serve
Expand Down
1,372 changes: 757 additions & 615 deletions poetry.lock

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ tomli = { version = "^2.0.1", python = "<3.11.0" }
tomlkit = "^0.12.3"
questionary = "^2.0.1"

# temporary pins
# pin numpy to fix compatibility between pyarrow (textual-fastdatatable)
# and harlequin-databricks. Should be able to remove when harlequin-databricks
# dependency on databricks-sql-connector gets updated
numpy = [
{ version = "<1.25.0,>=1.21.0", python = ">=3.8.0,<3.9.0"},
{ version = "<2.0.0,>=1.21.0", python = ">=3.9.0,<3.13.0"}
]

# optional deps
boto3 = { version = "^1.34.22", optional = true }

Expand All @@ -47,7 +56,8 @@ harlequin-mysql = { version = "^0.1", optional = true }
harlequin-odbc = { version = "^0.1", optional = true }
harlequin-bigquery = { version = "^1.0", optional = true }
harlequin-trino = { version = "^0.1", optional = true }
harlequin-databricks = { version = "^0.1", optional = true }
harlequin-databricks = { version = "^0.1", python = ">=3.9.0", optional = true }
harlequin-adbc = { version = "^0.1", python = ">=3.9.0", optional = true }

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.3.1"
Expand Down Expand Up @@ -83,6 +93,7 @@ odbc = ["harlequin-odbc"]
bigquery = ["harlequin-bigquery"]
trino = ["harlequin-trino"]
databricks = ["harlequin-databricks"]
adbc = ["harlequin-adbc"]

[tool.poetry.plugins."harlequin.adapter"]
duckdb = "harlequin_duckdb:DuckDbAdapter"
Expand All @@ -92,9 +103,11 @@ sqlite = "harlequin_sqlite:HarlequinSqliteAdapter"
harlequin = "harlequin.colors:HarlequinPygmentsStyle"

[tool.ruff]
select = ["A", "B", "E", "F", "I"]
target-version = "py38"

[tool.ruff.lint]
select = ["A", "B", "E", "F", "I"]

[tool.mypy]
python_version = "3.8"
files = [
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ def small_sqlite(tmp_path: Path, data_dir: Path) -> Path:
@pytest.fixture
def duckdb_adapter() -> type[HarlequinAdapter]:
eps = entry_points(group="harlequin.adapter")
cls: type[HarlequinAdapter] = eps["duckdb"].load() # type: ignore
cls: type[HarlequinAdapter] = eps["duckdb"].load()
return cls


@pytest.fixture
def sqlite_adapter() -> type[HarlequinAdapter]:
eps = entry_points(group="harlequin.adapter")
cls: type[HarlequinAdapter] = eps["sqlite"].load() # type: ignore
cls: type[HarlequinAdapter] = eps["sqlite"].load()
return cls


@pytest.fixture(params=["duckdb", "sqlite"])
def all_adapters(request: pytest.FixtureRequest) -> type[HarlequinAdapter]:
eps = entry_points(group="harlequin.adapter")
cls: type[HarlequinAdapter] = eps[request.param].load() # type: ignore
cls: type[HarlequinAdapter] = eps[request.param].load()
return cls


Expand Down

0 comments on commit ce6fd0e

Please sign in to comment.