Skip to content Skip to sidebar Skip to footer

Async - Pandas Read_sql And Asyncio?

Could someone please point me in the right direction on how to solve this following problem. I am trying to come up with a solution using pandas.read_sql and asyncio. I want to mig

Solution 1:

asyncio is about organizing non-blocking code into callbacks and coroutines. Running CPU-intensive code in parallel is a use case for threads:

from concurrent.futures import ThreadPoolExecutor

withThreadPoolExecutor() as executor:
    frames = list(executor.map(extract, all_tables))

Whether this will actually run faster than sequential code depends on whether pd.read_sql releases the GIL.

Post a Comment for "Async - Pandas Read_sql And Asyncio?"