Skip to content

synchronous psycopg2 dependency in postgres database sessionservice , while adk is async all the way #1750

Open
@athulds

Description

@athulds

Describe the bug
I can see the dependency on the synchronous psycopg2 db driver for postgres when I added DbSessionService. Since we are expecting adk to be fully async, need to understand why this dependency is in place and will it block the even loop during the db interactions ?

Or
it runs in a separate thread ?

Any plans to move to something like asyncpg ?

To Reproduce
Adk forcing to install psycopg2 when DbSessionService for postgres is enabled.

File "c:\Users..\workspace..\venv\Lib\site-packages\google\adk\sessions\database_session_service.py", line 314, in init
db_engine = create_engine(db_url, **kwargs)
File "", line 2, in create_engine
File "c:\Users..\workspace..\venv\Lib\site-packages\sqlalchemy\util\deprecations.py", line 281, in warned
return fn(*args, **kwargs) # type: ignore[no-any-return]
File "c:\Users..\workspace..\venv\Lib\site-packages\sqlalchemy\engine\create.py", line 602, in create_engine
dbapi = dbapi_meth(**dbapi_args)
File "c:\Users..\workspace..\venv\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg2.py", line 696, in import_dbapi
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'

Expected behavior
All the modules should be async

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions