Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Database Interactions to Async Using asyncpg #147

Open
5 tasks
vineetshar opened this issue Oct 30, 2024 · 7 comments
Open
5 tasks

Migrate Database Interactions to Async Using asyncpg #147

vineetshar opened this issue Oct 30, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@vineetshar
Copy link
Contributor

vineetshar commented Oct 30, 2024

Description:
To improve the performance and responsiveness of our APIs and services, we should transition from synchronous database interactions to asynchronous ones. By adopting asyncpg as our database interface, we align with the goal of providing truly asynchronous interfaces and runtime for all APIs and services.

Proposed Solution:

  • Replace current synchronous database connections and queries with asynchronous implementations using asyncpg.
  • Ensure all relevant service calls are updated to handle async database operations properly.

Tasks:

  • Research asyncpg capabilities and compatibility with our existing database structure.
  • Refactor database connection initialization to use asyncpg.
  • Update all current synchronous queries to asynchronous with asyncpg.
  • Test async implementations to verify expected performance improvements.
  • Update documentation to reflect the new async architecture.

Acceptance Criteria:

  • All database interactions are asynchronous, providing a non-blocking runtime.
  • All API endpoints and services leverage async for better concurrency and performance.
@vineetshar vineetshar added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Oct 30, 2024
@sarfarazsiddiquii
Copy link

Hi @vineetshar, can i work on this issue? can you please assign me?

@vineetshar
Copy link
Contributor Author

Yes @sarfarazsiddiquii this still needs to be done, sure you can pick it up. Let us know the plan of action here before you start implementing.

@sarfarazsiddiquii
Copy link

Hey @vineetshar
sure! I'll replace the current synchronous SQLAlchemy queries with asynchronous queries using asyncpg in database.py. Then, I will update all the database interactions (mainly in the modules directory) to use this new async approach.

@sarfarazsiddiquii
Copy link

Hi @vineetshar is everything alright in the method I mentioned?
Should I start with the issue?

@vineetshar
Copy link
Contributor Author

Hey @sarfarazsiddiquii yes you can proceed

@dhirenmathur
Copy link
Contributor

Hey @sarfarazsiddiquii let us know if you need any help

@sarfarazsiddiquii
Copy link

Hey @dhirenmathur, I am a bit confused about the approach. I’ve updated database.py to use async operations.
However, many files use synchronous database operations. Do we need to manually update all of these to async, or is there a way to streamline the process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants