diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e5b18..81c2490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -## 0.12.2 - -+ Fix imports in module `sqlalchemy.quart` - ## 0.12.1 + Fix import failure for `AsyncSelectPagination` (module `sqlalchemy`) diff --git a/src/suou/__init__.py b/src/suou/__init__.py index b50bb02..709b41d 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -38,7 +38,7 @@ from .http import WantsContentType from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, XYZColor, OKLCHColor from .mat import Matrix -__version__ = "0.12.2" +__version__ = "0.12.1" __all__ = ( 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', diff --git a/src/suou/sqlalchemy/__init__.py b/src/suou/sqlalchemy/__init__.py index d46ca8f..889d7ad 100644 --- a/src/suou/sqlalchemy/__init__.py +++ b/src/suou/sqlalchemy/__init__.py @@ -18,14 +18,19 @@ from __future__ import annotations from abc import ABCMeta, abstractmethod from functools import wraps -from typing import Callable, Iterable, Never, TypeVar -from sqlalchemy import LargeBinary, Column, create_engine, select -from sqlalchemy.orm import DeclarativeBase, Session +from typing import Any, Callable, Iterable, Never, TypeVar +import warnings +from sqlalchemy import BigInteger, Boolean, CheckConstraint, Date, Dialect, ForeignKey, LargeBinary, Column, MetaData, SmallInteger, String, create_engine, select, text +from sqlalchemy.orm import DeclarativeBase, InstrumentedAttribute, Relationship, Session, declarative_base as _declarative_base, relationship from sqlalchemy.types import TypeEngine +from suou.glue import FakeModule -from ..itertools import makelist +from ..snowflake import SnowflakeGen +from ..itertools import kwargs_prefix, makelist from ..signing import HasSigner, UserSigner -from ..functools import deprecated +from ..codecs import StringCase +from ..functools import deprecated, not_implemented +from ..iding import Siq, SiqGen, SiqType, SiqCache from ..classtools import Incomplete, Wanted diff --git a/src/suou/sqlalchemy/asyncio.py b/src/suou/sqlalchemy/asyncio.py index b28f305..e2bab47 100644 --- a/src/suou/sqlalchemy/asyncio.py +++ b/src/suou/sqlalchemy/asyncio.py @@ -26,10 +26,6 @@ from sqlalchemy import Select, Table, func, select from sqlalchemy.orm import DeclarativeBase, lazyload from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine -try: - from .quart import AsyncSelectPagination -except ImportError: - AsyncSelectPagination = None from suou.exceptions import NotFoundError from suou.glue import glue @@ -107,16 +103,13 @@ class SQLAlchemy: Return a pagination. Analogous to flask_sqlalchemy.SQLAlchemy.paginate(). """ async with self as session: - try: - return AsyncSelectPagination( - select = select, - session = session, - page = page, - per_page=per_page, max_per_page=max_per_page, - error_out=self.NotFound if error_out else None, count=count - ) - except Exception: - raise RuntimeError('Cannot paginate; required dependencies are not installed') + return AsyncSelectPagination( + select = select, + session = session, + page = page, + per_page=per_page, max_per_page=max_per_page, + error_out=self.NotFound if error_out else None, count=count + ) async def create_all(self, *, checkfirst = True): """ Initialize database diff --git a/src/suou/sqlalchemy/quart.py b/src/suou/sqlalchemy/quart.py index dd03f06..e314f06 100644 --- a/src/suou/sqlalchemy/quart.py +++ b/src/suou/sqlalchemy/quart.py @@ -3,13 +3,7 @@ SQLAlchemy-Quart bindings """ -from select import select from flask_sqlalchemy.pagination import Pagination -from sqlalchemy import Select, func -from sqlalchemy.ext.asyncio import AsyncSession -from sqlalchemy.orm import lazyload - -from ..exceptions import NotFoundError class AsyncSelectPagination(Pagination):