VortexCommerceBackend / run_seed_v2.py
hisham-cmd's picture
Optimized Sync: Differential Upload & Performance Tweak
60470bc
Raw
History Blame Contribute Delete
778 Bytes
import os
import sys
# Add the current directory to sys.path so we can import 'app'
sys.path.insert(0, os.path.join(os.getcwd(), "app"))
sys.path.insert(0, os.getcwd())
from app.db.base import SessionLocal
from app.api.seed import seed_database
def run():
print(">>> [LAUNCHER] Starting Hierarchical Seeding...")
db = SessionLocal()
try:
# Clear=True ensures a professional "From Scratch" reset
response = seed_database(clear=True, db=db)
print(">>> [LAUNCHER] Seeding Complete!")
print(f">>> Result: {response.value}")
except Exception as e:
print(f">>> [LAUNCHER] ERROR during seeding: {e}")
import traceback
traceback.print_exc()
finally:
db.close()
if __name__ == "__main__":
run()