Skip to content

Commit e41f462

Browse files
committed
Merge branch 'develop'
2 parents 1af5dd1 + 1a724d8 commit e41f462

File tree

13 files changed

+430
-307
lines changed

13 files changed

+430
-307
lines changed

docs/api/active-record-mixin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,7 @@ def smart_query(
19941994

19951995
```python
19961996
@classmethod
1997-
def get_async_query(query: Select[tuple[Any, ...]] | None = None) -> AsyncQuery[Self]
1997+
def get_async_query(query: Query | None = None) -> AsyncQuery[Self]
19981998
```
19991999

20002000
> Returns an `AsyncQuery` instance with the provided

docs/api/async-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async_query.query # <sqlalchemy.sql.Select at 0x...>
192192
#### query
193193

194194
```python
195-
query: Select[tuple[Any, ...]]
195+
query: Query
196196
```
197197

198198
> The wrapped `sqlalchemy.sql.Select` instance.

docs/api/smart-query-mixin.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,15 +971,16 @@ def eager_expr(schema: EagerSchema) -> list[_AbstractLoad]
971971
```python
972972
@classmethod
973973
def smart_query(
974-
query: Select[tuple[Any, ...]],
974+
cls,
975+
query: Query,
975976
criteria: Sequence[_ColumnExpressionArgument[bool]] | None = None,
976977
filters: DjangoFilters | None = None,
977978
sort_columns: Sequence[_ColumnExpressionOrStrLabelArgument[Any]] | None = None,
978979
sort_attrs: Sequence[str] | None = None,
979980
group_columns: Sequence[_ColumnExpressionOrStrLabelArgument[Any]] | None = None,
980981
group_attrs: Sequence[str] | None = None,
981982
schema: EagerSchema | None = None,
982-
) -> Select[tuple[Any, ...]]:
983+
) -> Query:
983984
```
984985
985986
> Creates a query combining filtering, sorting, grouping and eager loading.
@@ -1021,7 +1022,7 @@ def smart_query(
10211022
10221023
> **Returns**
10231024
1024-
> - `Select[tuple[Any, ...]]`: SQLAlchemy query with filtering, sorting,
1025+
> - `Query`: SQLAlchemy query with filtering, sorting,
10251026
> grouping and eager loading, that is to say, a beautiful smart query.
10261027
10271028
> **Examples**
@@ -1053,10 +1054,10 @@ def smart_query(
10531054
```python
10541055
@classmethod
10551056
def apply_search_filter(
1056-
query: Select[tuple[Any, ...]],
1057+
query: Query,
10571058
search_term: str,
10581059
columns: Sequence[str | InstrumentedAttribute[Any]] | None = None,
1059-
) -> Select[tuple[Any, ...]]
1060+
) -> Query
10601061
```
10611062
10621063
> Applies a search filter to the query.
@@ -1072,7 +1073,7 @@ def apply_search_filter(
10721073
10731074
> **Returns**
10741075
1075-
> - `Select[tuple[Any, ...]]`: SQLAlchemy query with the search filter applied.
1076+
> - `Query`: SQLAlchemy query with the search filter applied.
10761077
10771078
> **Examples**
10781079

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
aiosqlite==0.20.0
2-
colorlog==6.9.0
1+
aiosqlite>=0.20.0
2+
colorlog>=6.9.0
33
deprecated>=1.2.18
4-
sqlalchemy==2.0.36
4+
sqlalchemy>=2.0.0
55
typing-extensions>=4.12.2

sqlactive/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,4 @@ class BaseModel(ActiveRecordBaseModel):
241241
]
242242

243243

244-
__version__ = '0.3.2'
244+
__version__ = '0.3.3'

sqlactive/active_record.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ColumnExpressionOrStrLabelArgument,
2222
DjangoFilters,
2323
EagerSchema,
24+
Query,
2425
Self,
2526
)
2627
from .utils import classproperty
@@ -2169,9 +2170,7 @@ def smart_query(
21692170
return cls.get_async_query(smart_query)
21702171

21712172
@classmethod
2172-
def get_async_query(
2173-
cls, query: Select[tuple[Any, ...]] | None = None
2174-
) -> AsyncQuery[Self]:
2173+
def get_async_query(cls, query: Query | None = None) -> AsyncQuery[Self]:
21752174
"""Returns an ``AsyncQuery`` instance with
21762175
the provided ``sqlalchemy.sql.Select`` instance.
21772176
@@ -2180,7 +2179,7 @@ def get_async_query(
21802179
21812180
Parameters
21822181
----------
2183-
query : Select[tuple[Any, ...]] | None, optional
2182+
query : Query | None, optional
21842183
SQLAlchemy query, by default None.
21852184
21862185
Returns

sqlactive/async_query.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from sqlalchemy.engine import Result, Row, ScalarResult
77
from sqlalchemy.orm import joinedload, selectinload, subqueryload
88
from sqlalchemy.orm.attributes import InstrumentedAttribute
9-
from sqlalchemy.sql import Select
109
from sqlalchemy.sql._typing import _ColumnsClauseArgument
1110
from sqlalchemy.sql.base import ExecutableOption
1211
from sqlalchemy.sql.elements import ColumnElement
@@ -19,6 +18,7 @@
1918
ColumnExpressionOrStrLabelArgument,
2019
EagerLoadPath,
2120
EagerSchema,
21+
Query,
2222
Self,
2323
T,
2424
)
@@ -88,10 +88,10 @@ class AsyncQuery(SessionMixin, SmartQueryMixin, Generic[T]):
8888

8989
__abstract__ = True
9090

91-
query: Select[tuple[Any, ...]]
91+
query: Query
9292
"""The wrapped ``sqlalchemy.sql.Select`` instance."""
9393

94-
def __init__(self, query: Select[tuple[Any, ...]]) -> None:
94+
def __init__(self, query: Query) -> None:
9595
"""Builds an async wrapper for SQLAlchemy ``Query``.
9696
9797
.. warning::
@@ -100,7 +100,7 @@ def __init__(self, query: Select[tuple[Any, ...]]) -> None:
100100
101101
Parameters
102102
----------
103-
query : Select[tuple[Any, ...]]
103+
query : Query
104104
The ``sqlalchemy.sql.Select`` instance.
105105
"""
106106
self.query = query

sqlactive/exceptions.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@ def __init__(self, class_name: str, note: str = '') -> None:
3535
)
3636

3737

38-
class InvalidJoinMethodError(SQLActiveError, ValueError):
39-
"""Invalid join method."""
40-
41-
def __init__(self, join_method: str, note: str = '') -> None:
42-
"""Invalid join method.
43-
44-
Parameters
45-
----------
46-
join_method : str
47-
Join method.
48-
note : str, optional
49-
Additional note, by default ''.
50-
"""
51-
super().__init__(f'no such join method: {join_method!r}', note)
52-
53-
5438
class ModelAttributeError(SQLActiveError, AttributeError):
5539
"""Attribute not found in model."""
5640

0 commit comments

Comments
 (0)