25 lines
585 B
Python
25 lines
585 B
Python
from config.module import Module
|
|
from core.database import SessionLocal
|
|
from core.helper import get_file_name, get_parent_directory_name
|
|
|
|
|
|
def update_module_locals(path, _locals):
|
|
item = get_file_name(path)
|
|
module_name = get_parent_directory_name(path)
|
|
|
|
module = Module(module_name)
|
|
|
|
_locals[module.get_name(item)] = module.get_item(item)
|
|
|
|
|
|
def get_session():
|
|
session = SessionLocal()
|
|
try:
|
|
yield session
|
|
finally:
|
|
session.close()
|
|
|
|
|
|
def get_module(module: str) -> dict:
|
|
return Module(module).get_item("create_schema").construct().schema()
|