Skip to content

Commit

Permalink
chore: drop support for sqlalchemy 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dgilland committed Oct 3, 2023
1 parent 370bc41 commit 3feb531
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Engine

Nothing fancy here. The :attr:`sqlservice.database.Database.engine`` is created using ``sqlalchemy.create_engine`` under the hood using the database settings provided. Typically, the engine won't be used directly. Instead, database connections and sessions can be created using these methods:

- :meth:`sqlservice.database.Database.connect` - Returns an instance of ``sqlalchemy.future.Connection``
- :meth:`sqlservice.database.Database.connect` - Returns an instance of ``sqlalchemy.Connection``
- :meth:`sqlservice.database.Database.session` - Returns an instance of :class:`sqlservice.session.Session`` which is a subclass of ``sqlalchemy.orm.Session``
- :meth:`sqlservice.database.Database.begin` - Begins a transaction and returns an instance of :class:`sqlservice.session.Session``

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ package_dir =
packages = find:
python_requires = >=3.7
install_requires =
SQLAlchemy>=1.4.12
SQLAlchemy>=2.0

[options.packages.find]
where = src
Expand Down
7 changes: 1 addition & 6 deletions src/sqlservice/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import typing as t

from sqlalchemy import create_engine, select
from sqlalchemy.engine import Connection, Engine
from sqlalchemy.exc import DBAPIError
from sqlalchemy.pool import Pool

Expand All @@ -19,12 +20,6 @@
from .session import Session


try:
from sqlalchemy.future import Connection, Engine
except ImportError: # pragma: no cover
from sqlalchemy.engine import Connection, Engine # type: ignore


class Database(DatabaseABC):
"""
Database engine and ORM session management class.
Expand Down
8 changes: 1 addition & 7 deletions src/sqlservice/database_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
import typing as t

from sqlalchemy import MetaData, Table
from sqlalchemy.engine import URL
from sqlalchemy.engine import Connection, Engine, URL
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncEngine, AsyncSession
from sqlalchemy.orm import DeclarativeMeta, Session, sessionmaker

from .database_settings import DatabaseSettings
from .model import ModelBase


try:
from sqlalchemy.future import Connection, Engine
except ImportError: # pragma: no cover
from sqlalchemy.engine import Connection, Engine # type: ignore


class DatabaseABC(ABC):
settings: DatabaseSettings
session_class: t.Union[t.Type[Session], t.Type[AsyncSession]]
Expand Down
8 changes: 1 addition & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37, py38, py39, py310, py311, py{37}-sqlalchemy{14}
envlist = py37, py38, py39, py310, py311
isolated_build = true

[gh-actions]
Expand All @@ -17,9 +17,3 @@ commands =
{posargs:inv ci}
setenv =
TOX_ENV_SITE_PACKAGES_DIR = {envsitepackagesdir}
deps =
sqlalchemy14: sqlalchemy==1.4.*

[testenv:py{37}-sqlalchemy{14}]
commands =
{posargs:inv test}

0 comments on commit 3feb531

Please sign in to comment.