You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
synchronous psycopg2 dependency in postgres database sessionservice , while adk is async all the way #1750
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'
Hi @athulds , we made the interface change to make all session service async, but we haven't migrate the DB session service to be true async yet. I'll convert this into a feature request
@DeanChensj Sure. Yeah DBService is not yet async. Because of that the asyncpg driver is failing when we are dealing with postgres, primarily due to the sync functionalities like inspect etc. within the DBSessionService
Thanks
Activity
DeanChensj commentedon Jul 18, 2025
Hi @athulds , we made the interface change to make all session service async, but we haven't migrate the DB session service to be true async yet. I'll convert this into a feature request
athulds commentedon Jul 18, 2025
@DeanChensj Sure. Yeah DBService is not yet async. Because of that the asyncpg driver is failing when we are dealing with postgres, primarily due to the sync functionalities like inspect etc. within the DBSessionService
Thanks
hangfei commentedon Nov 8, 2025
Duplicate to : #1005
DeanChensj commentedon Nov 10, 2025
This is now closed by #2889