Initial commit: Robot ökoszisztéma v2.0 - Stabilizált jármű és szerviz robotok
This commit is contained in:
12
seed_discovery.py
Executable file
12
seed_discovery.py
Executable file
@@ -0,0 +1,12 @@
|
||||
# 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()
|
||||
Reference in New Issue
Block a user