MCPcopy Index your code
hub / github.com/questdb/questdb / batch_insert

Function batch_insert

benchmarks/src/main/python/insert_bench.py:56–68  ·  view source on GitHub ↗
(pool, records, batch_size=1000)

Source from the content-addressed store, hash-verified

54
55
56async def batch_insert(pool, records, batch_size=1000):
57 async with pool.acquire() as conn:
58 for i in range(0, len(records), batch_size):
59 batch = records[i:i + batch_size]
60
61 # Execute batch insert
62 await conn.executemany(
63 'INSERT INTO user_data(name, email, age, created_at) VALUES ($1, $2, $3, $4)',
64 batch
65 )
66
67 if i % 100_000 == 0:
68 print(f"Inserted {i} records")
69
70
71async def main():

Callers 1

mainFunction · 0.85

Calls 1

acquireMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…