Skip to content

Commit f2d1cb2

Browse files
committed
Add UUID to PRIMARY_KEY type union
Include UUID as a valid type for PRIMARY_KEY to support use cases requiring UUIDs. This ensures broader compatibility and type safety in key definitions.
1 parent 6d1ca0a commit f2d1cb2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sqlalchemy_bind_manager/_bind_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
def __init_bind(self, name: str, config: SQLAlchemyConfig):
9191
if not isinstance(config, SQLAlchemyConfig):
9292
raise InvalidConfigError(
93-
f"Config for bind `{name}` is not a SQLAlchemyConfig" f"object"
93+
f"Config for bind `{name}` is not a SQLAlchemyConfig object"
9494
)
9595

9696
engine_options: dict = config.engine_options or {}

sqlalchemy_bind_manager/_repository/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
# DEALINGS IN THE SOFTWARE.
2020

2121
from typing import Generic, List, TypeVar, Union
22+
from uuid import UUID
2223

2324
from pydantic import BaseModel, StrictInt, StrictStr
2425

2526
MODEL = TypeVar("MODEL")
26-
PRIMARY_KEY = Union[str, int, tuple, dict]
27+
PRIMARY_KEY = Union[str, int, tuple, dict, UUID]
2728

2829

2930
class PageInfo(BaseModel):

0 commit comments

Comments
 (0)