Save Markdowns

This commit is contained in:
h z
2024-12-06 15:13:20 +00:00
parent 48dd59f8e4
commit b3ec244e06
9 changed files with 100 additions and 34 deletions

View File

@@ -5,6 +5,11 @@ import importlib
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
package_name = "db.models"
for _, module_name, _ in pkgutil.iter_modules(__path__):
importlib.import_module(f"{package_name}.{module_name}")
table_models = []
for _, module_name, _ in pkgutil.iter_modules(__path__):
module = importlib.import_module(f"{package_name}.{module_name}")
if hasattr(module, module_name):
model = getattr(module, module_name)
if hasattr(model, "__tablename__"):
table_models.append(model)