Currently, there is a functional disparity between DuneClient (sync) and AsyncDuneClient. Several high-utility methods available in the synchronous client are missing from the asynchronous implementation, specifically:
download_csv(): Essential for fetching large datasets efficiently as streams.
get_latest_result_dataframe(): A convenience method widely used by data scientists to fetch results directly into Pandas.
run_sql() (Plus feature): For executing raw SQL.
Users migrating to async workflows (e.g., using asyncio to run concurrent queries) currently lose access to these convenient methods. They are forced to either:
- Manually implement the HTTP fetching/parsing logic.
- Fall back to synchronous calls, blocking their event loop.
I would like to contribute a PR to implement these missing methods in AsyncDuneClient, ensuring they match the behavior of their synchronous counterparts in client.py but using aiohttp / async patterns.
Proposed Changes:
- Implement download_csv in client_async.py using aiohttp streams.
- Implement get_latest_result_dataframe (wrapping the CSV download).
- Add relevant unit tests.
If this aligns with the project's roadmap, I am happy to submit a PR!