Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ChangeLog
3.3.2 (unreleased)
------------------

- Nothing changed yet.
- Add typing information to SQLAlchemy model factory


3.3.1 (2024-08-18)
Expand Down
5 changes: 4 additions & 1 deletion factory/alchemy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright: See the LICENSE file.

from typing import TypeVar

from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound

Expand All @@ -12,6 +14,7 @@
SESSION_PERSISTENCE_COMMIT,
SESSION_PERSISTENCE_FLUSH,
]
T = TypeVar('T')


class SQLAlchemyOptions(base.FactoryOptions):
Expand Down Expand Up @@ -43,7 +46,7 @@ def _build_default_options(self):
]


class SQLAlchemyModelFactory(base.Factory):
class SQLAlchemyModelFactory(base.Factory[T]):
"""Factory for SQLAlchemy models. """

_options_class = SQLAlchemyOptions
Expand Down