core.orm
Submodules
Attributes
Classes
Functions
|
Finds the ORM models in the given ORM base class that match a filter. |
Package Contents
- core.orm.find_models[T, TG](base: type[T], is_match: collections.abc.Callable[[type[T]], TypeGuard[TG]]) collections.abc.Iterator[type[TG]][source]
- core.orm.find_models(base: type[T], is_match: collections.abc.Callable[[type[T]], TypeIs[TG]]) collections.abc.Iterator[type[TG]]
- core.orm.find_models(base: type[T], is_match: collections.abc.Callable[[type[T]], bool]) collections.abc.Iterator[type[T]]
Finds the ORM models in the given ORM base class that match a filter.
The filter is called with each class in the instance and it is supposed to return True if it matches.
For example, find all SQLAlchemy models that use
ContentMixin:from onegov.core.orm.mixins import ContentMixin find_models(base, is_match=lambda cls: issubclass(cls, ContentMixin))