Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
# The SQLAlchemy every run installs: one exact version, never a range or the
# newest release, so a run changes only when this line does. A newer
# SQLAlchemy is a deliberate upgrade of its own.
SQLALCHEMY: "2.0.54"
SQLALCHEMY: "2.1.0"

jobs:
compliance:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.10"
python-version: "3.11"
- run: pip install ruff
- run: ruff check sqlalchemy_seerdb test
- run: ruff format --check sqlalchemy_seerdb test
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ env:
# The SQLAlchemy every run installs: one exact version, never a range or the
# newest release, so a run changes only when this line does. A newer
# SQLAlchemy is a deliberate upgrade of its own.
SQLALCHEMY: "2.0.54"
SQLALCHEMY: "2.1.0"

jobs:
# The gating job, and deliberately the only one. It needs no database, so it
Expand All @@ -44,7 +44,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
Expand All @@ -69,15 +69,14 @@ jobs:
# commits every statement unless told otherwise, and SQLAlchemy's
# transactions would mean nothing.
args = dialect().create_connect_args(url)[1]
# fetch_lobs is feature-detected in the dialect: it is present (False)
# only with seerdb >= 3.0 and absent on older drivers, which the
# dialect supports on purpose. Pop it so this check covers both.
fetch_lobs = args.pop('fetch_lobs', None)
# fetch_lobs is always requested now that the driver floor is
# seerdb>=3.0.0 (it returns LOB objects by default; this dialect is
# built on the values).
assert args == {
'host': 'h', 'port': 1521, 'user': 'u', 'password': 'p',
'service_name': 'XE', 'timeout': 5000, 'autocommit': False,
'fetch_lobs': False,
}, args
assert fetch_lobs in (None, False), fetch_lobs
assert isinstance(args['timeout'], int), 'query args must be coerced'
print('entry point OK:', dialect.__module__ + '.' + dialect.__name__)
PY
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ build-backend = "setuptools.build_meta"

[project]
name = "sqlalchemy-seerdb"
version = "0.2.2"
version = "0.3.0"
description = "SQLAlchemy dialect for the seerdb driver"
readme = "README.md"
license = "MIT"
license-files = ["LICENSES/MIT.txt"]
requires-python = ">=3.10"
requires-python = ">=3.11"
authors = [{ name = "Peter Lemenkov", email = "lemenkov@gmail.com" }]
keywords = ["sqlalchemy", "dialect", "database", "dbapi"]
classifiers = [
Expand All @@ -21,7 +21,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Database",
]
dependencies = ["SQLAlchemy>=2.0", "seerdb>=2.5.0"]
dependencies = ["SQLAlchemy>=2.0", "seerdb>=3.0.0"]

[project.urls]
Homepage = "https://github.com/seerdb/sqlalchemy-seerdb"
Expand Down
25 changes: 2 additions & 23 deletions sqlalchemy_seerdb/seerdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,23 +257,6 @@ def bindparam_string(self, name, **kw):
return super().bindparam_string(name, **kw)


def _driver_has_fetch_lobs() -> bool:
"""Whether the installed driver understands ``fetch_lobs``.

It arrived in seerdb 3.0 together with the LOB object; passing it to an
older driver is a TypeError, and this dialect supports both."""
import inspect

try:
params = inspect.signature(seerdb.OracleConnect.__init__).parameters
except (AttributeError, TypeError, ValueError):
return False
return 'fetch_lobs' in params


_DRIVER_HAS_FETCH_LOBS = _driver_has_fetch_lobs()


class SeerdbDialect(OracleDialect):
"""SQLAlchemy dialect driving the seerdb DBAPI."""

Expand Down Expand Up @@ -393,12 +376,8 @@ def create_connect_args(self, url: URL) -> tuple[list, dict]:
# comparison the compliance suite makes, are written against values.
# seerdb 3.0 returns a LOB OBJECT by default instead (matching
# python-oracledb), so ask for the values this dialect is built on.
#
# Feature-detected rather than pinned: the same dialect still has to
# work against a driver that predates the option, and its floor cannot
# be raised to a release that is not published yet.
if _DRIVER_HAS_FETCH_LOBS:
options['fetch_lobs'] = False
# The driver floor is seerdb>=3.0.0, so the option is always understood.
options['fetch_lobs'] = False
for key, value in url.query.items():
# A repeated key arrives as a tuple; the driver takes one value.
options[key] = _coerce(
Expand Down
Loading