refs #0 The root commit.
This commit is contained in:
17
back/config/model.py
Normal file
17
back/config/model.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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())
|
||||
Reference in New Issue
Block a user