What is the best practice to use v4 python client for query with fastapi(or other async python framework)

Since v4 doesn’t support async method, I am planning to wrap it with asyncio.to_thread.

Can I assume I can use the same client form multithread for query?
if I don’t use batch ops is that safe to use the same client for update or insert ops?
Is there any connection pool under the hood of v4 client?

Hi!

That should work. Also, while initiating the connection, you can use skip_init_checks=True in order to avoid initial checks for the connection and make it faster.

Here the code for this parameter:

That for querying. While for importing using batch, you should avoid using multiple clients.

Have you tried the latest v4 beta (4.4b8)? It does support async.

Have you tried the latest v4 beta (4.4b8)? It does support async.

It uses async for concurrent batching in the background, but there is no support for users doing async queries themselves. We did some preparation for real async support (switching to httpx, and some plumbing), but it will most likely be added for users after v4 is stable.

Can I assume I can use the same client form multithread for query?
if I don’t use batch ops is that safe to use the same client for update or insert ops?

We have not tried it, but I think insert/update should be ok. But query is not.

Is there any connection pool under the hood of v4 client?

for insert()/update() yes, we use httpx with a session pool.

I know async batch import is supported.
what I said is async query and other operation

We have not tried it, but I think insert/update should be ok. But query is not.

So I must use different client when using multi-thread for query?