Skip to content

Commit

Permalink
fix: revert protocol change
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Nov 18, 2024
1 parent faa8259 commit bedb841
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 39 deletions.
25 changes: 5 additions & 20 deletions advanced_alchemy/repository/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,15 @@

@runtime_checkable
class SQLAlchemyAsyncRepositoryProtocol(FilterableRepositoryProtocol[ModelT], Protocol[ModelT]):
"""Protocol defining the interface for async SQLAlchemy repositories.
This protocol defines the required attributes and methods that any async
SQLAlchemy repository implementation must provide.
Type Parameters:
ModelT: The SQLAlchemy model type this repository handles.
Attributes:
session: The SQLAlchemy async session for database operations.
id_attribute: Name of the primary identifier attribute (default: "id").
auto_commit: Whether to automatically commit after operations (default: False).
auto_expunge: Whether to automatically expunge instances after operations (default: False).
auto_refresh: Whether to automatically refresh instances after operations (default: False).
match_fields: Fields to match when checking existence (default: None).
order_by: Default ordering specification for queries (default: None).
error_messages: Custom error message templates (default: None).
"""
"""Base Protocol"""

id_attribute: Any
match_fields: list[str] | str | None = None
statement: Select[tuple[ModelT]]
session: AsyncSession | async_scoped_session[AsyncSession]
id_attribute: str
auto_commit: bool
auto_expunge: bool
auto_refresh: bool
auto_commit: bool
order_by: list[OrderingPair] | OrderingPair | None = None
error_messages: ErrorMessages | None = None

Expand Down
20 changes: 1 addition & 19 deletions advanced_alchemy/repository/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,7 @@

@runtime_checkable
class SQLAlchemySyncRepositoryProtocol(FilterableRepositoryProtocol[ModelT], Protocol[ModelT]):
"""Protocol defining the interface for async SQLAlchemy repositories.
This protocol defines the required attributes and methods that any async
SQLAlchemy repository implementation must provide.
Type Parameters:
ModelT: The SQLAlchemy model type this repository handles.
Attributes:
id_attribute: Name of the primary identifier attribute.
match_fields: Fields to match when checking existence.
statement: The SQL statement to execute.
session: The SQLAlchemy session for database operations.
auto_expunge: Whether to automatically expunge instances after operations.
auto_refresh: Whether to automatically refresh instances after operations.
auto_commit: Whether to automatically commit after operations.
order_by: Default ordering specification for queries.
error_messages: Custom error message templates.
"""
"""Base Protocol"""

id_attribute: Any
match_fields: list[str] | str | None = None
Expand Down

0 comments on commit bedb841

Please sign in to comment.