InfluxCommunity / influxdb3-python

Python module that provides a simple and convenient way to interact with InfluxDB 3.0.
https://www.influxdata.com
Apache License 2.0
59 stars 9 forks source link

Async Client #53

Open Jayclifford345 opened 1 year ago

Jayclifford345 commented 1 year ago

Check whether it is currently possible to create an Aysnc version of the client based on the underlining Arrow library.

  1. Write API currently supports Aysnc through parent library inheritance The support was removed at #62 (note by @bednar)
  2. Query API needs to be investigated
thopewell commented 10 months ago

@Jayclifford345 has any progress been made in the investigation into async on the query api for Influx3.0?

Similar to this discussion/issue in the v2 python client: https://github.com/influxdata/influxdb-python/issues/452 I'm adding an endpoint to an api, the endpoint will query influx 3.0 and return some data, but the framework I'm plugging into uses async.

I'm not sure how best to do this:

Jayclifford345 commented 10 months ago

Hi @thopewell, I am currently struggling to create a clean solution for this since from what I can see underlining pyarrow flight library does not currently have an inherently Async solution. It might be something we need to raise with the greater pyarrow community

LostInDarkMath commented 7 months ago

Yes, an async client would be great :)

Jayclifford345 commented 7 months ago

Hi there, I belive we need to wait for the upstream library Pyarrow to implement the necessary functionality before we are able to move forward: https://github.com/apache/arrow/issues/3151

LostInDarkMath commented 7 months ago

Thanks for your fast reply!

The issue you mentioned is closed and there is a linked gist. So I guess the gist is not enough to provide an async influxDB client?

pvardanis commented 6 months ago

Is it possible to run concurrent requests on an Arrow Flight RPC server without using an async FlightClient (since it doesn't exist yet)?

jules-ch commented 3 weeks ago

I have been delegating queries to threads using the same client. I haven't seen any problems so far. I don't know if the Pyarrow implementation is thread safe. You can also use aiogrpc since Flight is using GRPC under the hood (tried it, it works but you need to deal with the IPC messages and header bytes). The pyArrow implementation is using the C++ client from the Python bindings with Cython which releases the GIL. Don't know about performance, just use pure sync and threads I'd say until pyarrow release an asynchronous version.