Save Markdowns
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user