12 lines
629 B
Python
12 lines
629 B
Python
# seed_discovery.py
|
|
async def seed():
|
|
# Az RDW-től lekérjük az ÖSSZES egyedi márkát
|
|
url = "https://opendata.rdw.nl/resource/m9d7-ebf2.json?$select=distinct%20merk&$limit=50000"
|
|
async with httpx.AsyncClient() as client:
|
|
resp = await client.get(url)
|
|
makes = resp.json()
|
|
async with SessionLocal() as db:
|
|
for item in makes:
|
|
m = item['merk'].upper()
|
|
await db.execute(text("INSERT INTO data.catalog_discovery (make, model, source, status) VALUES (:m, 'ALL', 'global_seed', 'pending') ON CONFLICT DO NOTHING"), {"m": m})
|
|
await db.commit() |