questdb / py-questdb-client

Python client for QuestDB InfluxDB Line Protocol
https://py-questdb-client.readthedocs.io
Apache License 2.0
49 stars 7 forks source link

feat: HTTP SenderPool with asyncio support #66

Open amunra opened 3 months ago

amunra commented 3 months ago

Overview

A new API to make it easier to work with the sender asynchronously with true parallelism.

from questdb.ingress.pool import SenderPool

with SenderPool('http::addr=localhost:9000;') as pool:
    # Buffers can be safely constructed independently,
    # also on separate threads.
    buf1 = pool.transaction('tbl1')
    buf1.row(...)

    buf2 = pool.transaction('tbl2')
    buf2.dataframe(...)

    # parallelism
    fut1 = buf1.commit()
    fut2 = buf2.commit()

    await fut1
    await fut2

Details

API downsides

Thread safety and Parallelism

Tasks

Closes https://github.com/questdb/py-questdb-client/issues/64