Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 634d251395 |
5 changed files with 30 additions and 18 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.12.2
|
||||||
|
|
||||||
|
+ Fix imports in module `sqlalchemy.quart`
|
||||||
|
|
||||||
## 0.12.1
|
## 0.12.1
|
||||||
|
|
||||||
+ Fix import failure for `AsyncSelectPagination` (module `sqlalchemy`)
|
+ Fix import failure for `AsyncSelectPagination` (module `sqlalchemy`)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ from .http import WantsContentType
|
||||||
from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, XYZColor, OKLCHColor
|
from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, XYZColor, OKLCHColor
|
||||||
from .mat import Matrix
|
from .mat import Matrix
|
||||||
|
|
||||||
__version__ = "0.12.1"
|
__version__ = "0.12.2"
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue',
|
'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue',
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,14 @@ from __future__ import annotations
|
||||||
|
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Callable, Iterable, Never, TypeVar
|
from typing import Callable, Iterable, Never, TypeVar
|
||||||
import warnings
|
from sqlalchemy import LargeBinary, Column, create_engine, select
|
||||||
from sqlalchemy import BigInteger, Boolean, CheckConstraint, Date, Dialect, ForeignKey, LargeBinary, Column, MetaData, SmallInteger, String, create_engine, select, text
|
from sqlalchemy.orm import DeclarativeBase, Session
|
||||||
from sqlalchemy.orm import DeclarativeBase, InstrumentedAttribute, Relationship, Session, declarative_base as _declarative_base, relationship
|
|
||||||
from sqlalchemy.types import TypeEngine
|
from sqlalchemy.types import TypeEngine
|
||||||
from suou.glue import FakeModule
|
|
||||||
|
|
||||||
from ..snowflake import SnowflakeGen
|
from ..itertools import makelist
|
||||||
from ..itertools import kwargs_prefix, makelist
|
|
||||||
from ..signing import HasSigner, UserSigner
|
from ..signing import HasSigner, UserSigner
|
||||||
from ..codecs import StringCase
|
from ..functools import deprecated
|
||||||
from ..functools import deprecated, not_implemented
|
|
||||||
from ..iding import Siq, SiqGen, SiqType, SiqCache
|
|
||||||
from ..classtools import Incomplete, Wanted
|
from ..classtools import Incomplete, Wanted
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,10 @@ from sqlalchemy import Select, Table, func, select
|
||||||
from sqlalchemy.orm import DeclarativeBase, lazyload
|
from sqlalchemy.orm import DeclarativeBase, lazyload
|
||||||
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine
|
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.exceptions import NotFoundError
|
||||||
from suou.glue import glue
|
from suou.glue import glue
|
||||||
|
|
@ -103,6 +107,7 @@ class SQLAlchemy:
|
||||||
Return a pagination. Analogous to flask_sqlalchemy.SQLAlchemy.paginate().
|
Return a pagination. Analogous to flask_sqlalchemy.SQLAlchemy.paginate().
|
||||||
"""
|
"""
|
||||||
async with self as session:
|
async with self as session:
|
||||||
|
try:
|
||||||
return AsyncSelectPagination(
|
return AsyncSelectPagination(
|
||||||
select = select,
|
select = select,
|
||||||
session = session,
|
session = session,
|
||||||
|
|
@ -110,6 +115,8 @@ class SQLAlchemy:
|
||||||
per_page=per_page, max_per_page=max_per_page,
|
per_page=per_page, max_per_page=max_per_page,
|
||||||
error_out=self.NotFound if error_out else None, count=count
|
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):
|
async def create_all(self, *, checkfirst = True):
|
||||||
"""
|
"""
|
||||||
Initialize database
|
Initialize database
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,13 @@ SQLAlchemy-Quart bindings
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from select import select
|
||||||
from flask_sqlalchemy.pagination import Pagination
|
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):
|
class AsyncSelectPagination(Pagination):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue