File size: 778 Bytes
60470bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()