Spaces:
Sleeping
Sleeping
Delete counts.py with huggingface_hub
Browse files
counts.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
import sys
|
| 2 |
-
import os
|
| 3 |
-
sys.path.append(os.getcwd())
|
| 4 |
-
from sqlalchemy import create_engine
|
| 5 |
-
from app.db.base import settings
|
| 6 |
-
from app.models.product import Product, Category
|
| 7 |
-
|
| 8 |
-
# Use port 6543 for transaction mode (more reliable on Supabase)
|
| 9 |
-
db_url = settings.DATABASE_URL.replace(":5432/", ":6543/")
|
| 10 |
-
engine = create_engine(db_url)
|
| 11 |
-
from sqlalchemy.orm import sessionmaker
|
| 12 |
-
SessionLocal = sessionmaker(bind=engine)
|
| 13 |
-
|
| 14 |
-
db = SessionLocal()
|
| 15 |
-
try:
|
| 16 |
-
p_count = db.query(Product).count()
|
| 17 |
-
c_count = db.query(Category).count()
|
| 18 |
-
print(f"Product count: {p_count}")
|
| 19 |
-
print(f"Category count: {c_count}")
|
| 20 |
-
finally:
|
| 21 |
-
db.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|