átlagos kiegészítséek jó sok
This commit is contained in:
@@ -16,9 +16,10 @@ JAVÍTÁSOK:
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
from app.database import AsyncSessionLocal
|
||||
from app.models.asset import AssetCatalog, CatalogDiscovery
|
||||
from app.models.staged_data import DiscoveryParameter
|
||||
from app.models import AssetCatalog, CatalogDiscovery
|
||||
from app.models.marketplace.staged_data import DiscoveryParameter
|
||||
|
||||
# Logolás beállítása
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(levelname)s] Sentinel-Seed: %(message)s')
|
||||
@@ -56,14 +57,20 @@ async def quick_seed():
|
||||
("YAMAHA", "ALL")
|
||||
]
|
||||
|
||||
# Use INSERT ... ON CONFLICT DO NOTHING to avoid duplicate key errors
|
||||
for m, mod in discovery_queue:
|
||||
# Az attempts=0 kötelező a DB kényszer miatt
|
||||
db.add(CatalogDiscovery(
|
||||
make=m,
|
||||
model=mod,
|
||||
status="pending",
|
||||
attempts=0
|
||||
))
|
||||
stmt = insert(CatalogDiscovery).values(
|
||||
make=m,
|
||||
model=mod,
|
||||
status="pending",
|
||||
attempts=0,
|
||||
vehicle_class="car", # Default value
|
||||
market="GLOBAL", # Default value
|
||||
priority_score=0 # Default value
|
||||
)
|
||||
# Handle conflict on make+model+vehicle_class unique constraint
|
||||
stmt = stmt.on_conflict_do_nothing(index_elements=['make', 'model', 'vehicle_class'])
|
||||
await db.execute(stmt)
|
||||
|
||||
# 3. Arany rekordok (AssetCatalog / vehicle_catalog tábla)
|
||||
# Példa adatok, amik már átmentek a validációs folyamaton.
|
||||
|
||||
Reference in New Issue
Block a user