18 lines
410 B
Python
18 lines
410 B
Python
from core.config_factory import ModelConfig
|
|
from core.database import Base
|
|
from core.typing import Model
|
|
|
|
|
|
def create_model(module_name: str) -> Model:
|
|
"""
|
|
Creates SQLAlchemy model.
|
|
|
|
Returns created SQLAlchemy model.
|
|
|
|
:param module_name: The name of the module.
|
|
"""
|
|
|
|
config = ModelConfig(module_name)
|
|
|
|
return type(config.module.get_name("model"), (Base,), config.get_model_attrs())
|