filters¶
Collection filter datastructures.
- class advanced_alchemy.filters.BeforeAfter[source]¶
Bases:
StatementFilter
Data required to filter a query on a
datetime
column.- append_to_statement(statement: Select[tuple[ModelT]], model: type[ModelT]) Select[tuple[ModelT]] [source]¶
- class advanced_alchemy.filters.CollectionFilter[source]¶
Bases:
InAnyFilter
,Generic
[T
]Data required to construct a
WHERE ... IN (...)
clause.- values: Collection[T] | None¶
Values for
IN
clause.An empty list will return an empty result set, however, if
None
, the filter is not applied to the query, and all rows are returned.
- append_to_statement(statement: Select[tuple[ModelT]], model: type[ModelT], prefer_any: bool = False) Select[tuple[ModelT]] [source]¶
- append_to_lambda_statement(statement: StatementLambdaElement, model: type[ModelT], prefer_any: bool = False) StatementLambdaElement [source]¶
- __init__(field_name: str, values: Collection[T] | None) None ¶
- advanced_alchemy.filters.FilterTypes: TypeAlias = 'BeforeAfter | OnBeforeAfter | CollectionFilter[Any] | LimitOffset | OrderBy | SearchFilter | NotInCollectionFilter[Any] | NotInSearchFilter'¶
Aggregate type alias of the types supported for collection filtering.
- class advanced_alchemy.filters.LimitOffset[source]¶
Bases:
PaginationFilter
Data required to add limit/offset filtering to a query.
- append_to_statement(statement: Select[tuple[ModelT]], model: type[ModelT]) Select[tuple[ModelT]] [source]¶
- class advanced_alchemy.filters.OrderBy[source]¶
Bases:
StatementFilter
Data required to construct a
ORDER BY ...
clause.
- class advanced_alchemy.filters.SearchFilter[source]¶
Bases:
StatementFilter
Data required to construct a
WHERE field_name LIKE '%' || :value || '%'
clause.- get_search_clauses(model: type[ModelT]) list[sqlalchemy.sql.elements.BinaryExpression[bool]] [source]¶
- class advanced_alchemy.filters.NotInCollectionFilter[source]¶
Bases:
InAnyFilter
,Generic
[T
]Data required to construct a
WHERE ... NOT IN (...)
clause.- values: Collection[T] | None¶
Values for
NOT IN
clause.An empty list or
None
will return all rows.
- append_to_statement(statement: Select[tuple[ModelT]], model: type[ModelT], prefer_any: bool = False) Select[tuple[ModelT]] [source]¶
- append_to_lambda_statement(statement: StatementLambdaElement, model: type[ModelT], prefer_any: bool = False) StatementLambdaElement [source]¶
- __init__(field_name: str, values: Collection[T] | None) None ¶
- class advanced_alchemy.filters.OnBeforeAfter[source]¶
Bases:
StatementFilter
Data required to filter a query on a
datetime
column.- append_to_statement(statement: Select[tuple[ModelT]], model: type[ModelT]) Select[tuple[ModelT]] [source]¶
- class advanced_alchemy.filters.NotInSearchFilter[source]¶
Bases:
SearchFilter
Data required to construct a
WHERE field_name NOT LIKE '%' || :value || '%'
clause.
- class advanced_alchemy.filters.PaginationFilter[source]¶
Bases:
StatementFilter
,ABC
Subclass for methods that function as a pagination type.
- class advanced_alchemy.filters.InAnyFilter[source]¶
Bases:
StatementFilter
,ABC
Subclass for methods that have a prefer_any attribute.