Spaces:
Sleeping
Sleeping
Delete seed_all.py with huggingface_hub
Browse files- seed_all.py +0 -37
seed_all.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import shutil
|
| 4 |
-
|
| 5 |
-
# Ensure the backend app is in path
|
| 6 |
-
sys.path.insert(0, os.path.dirname(__file__))
|
| 7 |
-
|
| 8 |
-
from app.db.base import SessionLocal
|
| 9 |
-
from app.api.seed import seed_database
|
| 10 |
-
|
| 11 |
-
def main():
|
| 12 |
-
# 1. Copy the JSON file
|
| 13 |
-
src = r"c:\react_projects\VortexCommerce\kaggle\extra_products_vortex.json"
|
| 14 |
-
dst_dir = r"c:\react_projects\VortexCommerce\backend\kaggle"
|
| 15 |
-
|
| 16 |
-
if not os.path.exists(dst_dir):
|
| 17 |
-
os.makedirs(dst_dir)
|
| 18 |
-
|
| 19 |
-
dst = os.path.join(dst_dir, "extra_products_vortex.json")
|
| 20 |
-
print(f"Copying {src} to {dst}...")
|
| 21 |
-
shutil.copy(src, dst)
|
| 22 |
-
print("Copy completed.")
|
| 23 |
-
|
| 24 |
-
# 2. Seed database
|
| 25 |
-
db = SessionLocal()
|
| 26 |
-
try:
|
| 27 |
-
print("Starting Seeder...")
|
| 28 |
-
response = seed_database(db=db)
|
| 29 |
-
print("Seeding Response:")
|
| 30 |
-
print(response.value)
|
| 31 |
-
except Exception as e:
|
| 32 |
-
print(f"Error seeding: {e}")
|
| 33 |
-
finally:
|
| 34 |
-
db.close()
|
| 35 |
-
|
| 36 |
-
if __name__ == "__main__":
|
| 37 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|