Spaces:
Sleeping
Sleeping
Delete diag_counts.py with huggingface_hub
Browse files1234567891011121314151617181920212223242526import jsonimport osimport syssys.path.append(os.getcwd())from sqlalchemy import create_enginefrom app.db.base import settingsfrom app.models.product import Product, Category
# 1. Count in JSONjson_path = r'c:\react_projects\VortexCommerce\kaggle\extra_products_vortex.json'with open(json_path, "r", encoding="utf-8") as f: data = json.load(f)json_count = len(data["products"]) if isinstance(data, dict) else len(data)print(f"JSON Product Count: {json_count}")
# 2. Count in DBdb_url = settings.DATABASE_URL.replace(":5432/", ":6543/")engine = create_engine(db_url)from sqlalchemy.orm import sessionmakerSessionLocal = sessionmaker(bind=engine)db = SessionLocal()db_count = db.query(Product).count()cat_count = db.query(Category).count()print(f"DB Product Count: {db_count}")print(f"DB Category Count: {cat_count}")db.close()diag_counts.pyDeleted-26