Skip to content

Commit c1417b9

Browse files
feat: expand SQLAlchemy filter value type union with int, Decimal, datetime, date, and Enum
1 parent 7421bc8 commit c1417b9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

archipy/adapters/base/sqlalchemy/adapters.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from datetime import date, datetime
2+
from decimal import Decimal
13
from enum import Enum
24
from typing import Any, NoReturn, TypeVar, override
35
from uuid import UUID
@@ -81,7 +83,7 @@ class SQLAlchemyFilterMixin:
8183

8284
@staticmethod
8385
def _validate_list_operation(
84-
value: str | float | bool | list | UUID | None,
86+
value: str | float | bool | Decimal | list | UUID | datetime | date | Enum | None,
8587
operation: FilterOperationType,
8688
) -> list:
8789
"""Validate that value is a list for list operations."""
@@ -93,7 +95,7 @@ def _validate_list_operation(
9395
def _apply_filter(
9496
query: Select | Update | Delete,
9597
field: InstrumentedAttribute,
96-
value: str | float | bool | list | UUID | None,
98+
value: str | float | bool | Decimal | list | UUID | datetime | date | Enum | None,
9799
operation: FilterOperationType,
98100
) -> Select | Update | Delete:
99101
"""Apply a filter to a SQLAlchemy query based on the specified operation.

0 commit comments

Comments
 (0)