Compare commits

..

1 commit

Author SHA1 Message Date
634d251395 0.12.2 fix imports (again) 2026-01-29 19:15:48 +01:00
5 changed files with 30 additions and 18 deletions

View file

@ -1,5 +1,9 @@
# Changelog
## 0.12.2
+ Fix imports in module `sqlalchemy.quart`
## 0.12.1
+ Fix import failure for `AsyncSelectPagination` (module `sqlalchemy`)

View file

@ -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.1"
__version__ = "0.12.2"
__all__ = (
'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue',

View file

@ -18,19 +18,14 @@ from __future__ import annotations
from abc import ABCMeta, abstractmethod
from functools import wraps
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 typing import Callable, Iterable, Never, TypeVar
from sqlalchemy import LargeBinary, Column, create_engine, select
from sqlalchemy.orm import DeclarativeBase, Session
from sqlalchemy.types import TypeEngine
from suou.glue import FakeModule
from ..snowflake import SnowflakeGen
from ..itertools import kwargs_prefix, makelist
from ..itertools import makelist
from ..signing import HasSigner, UserSigner
from ..codecs import StringCase
from ..functools import deprecated, not_implemented
from ..iding import Siq, SiqGen, SiqType, SiqCache
from ..functools import deprecated
from ..classtools import Incomplete, Wanted

View file

@ -26,6 +26,10 @@ 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
@ -103,13 +107,16 @@ class SQLAlchemy:
Return a pagination. Analogous to flask_sqlalchemy.SQLAlchemy.paginate().
"""
async with self as session:
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
)
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')
async def create_all(self, *, checkfirst = True):
"""
Initialize database

View file

@ -3,7 +3,13 @@ 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):