-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
adk migrate session fails with greenlet_spawn error when using async driver URLs
Description
The adk migrate session command fails when using async driver URLs like postgresql+asyncpg://. The migration implementation uses synchronous SQLAlchemy but doesn't validate driver compatibility.
Environment
- ADK Version: 1.22.1
- Database: PostgreSQL
- Python: 3.12
- Drivers: asyncpg, psycopg2-binary
Steps to Reproduce
adk migrate session \
--source_db_url "postgresql+asyncpg://postgres:pass@localhost:5432/source" \
--dest_db_url "postgresql+asyncpg://postgres:pass@localhost:5432/dest" \
--log_level infoError Output
2026-01-16 10:43:27,300 - INFO - migrate_from_sqlalchemy_pickle.py:168 - Connecting to source database
2026-01-16 10:43:27,323 - INFO - migrate_from_sqlalchemy_pickle.py:176 - Connecting to destination database
2026-01-16 10:43:27,324 - ERROR - migrate_from_sqlalchemy_pickle.py:182 - Failed to connect to destination database:
greenlet_spawn has not been called; can't call await_only() here.
Was IO attempted in an unexpected place?Root Cause
Files affected:
google/adk/sessions/migration/migrate_from_sqlalchemy_pickle.py (lines 168, 182)
google/adk/sessions/migration/migration_runner.py (calls the above)
The migration uses create_engine() (synchronous) but doesn't reject async driver URLs:
# Line 168
source_engine = create_engine(source_db_url) # Synchronous
# Line 182
dest_engine = create_engine(dest_db_url) # Synchronous - fails with async URLsExpected Behavior
Either support async drivers OR show clear error: "Migration requires synchronous drivers. Use postgresql:// not postgresql+asyncpg://"
Impact
Affects all users migrating v0 → v1 schema with PostgreSQL. Creates documentation mismatch since ADK 1.22.1 requires async drivers for runtime but the migration tool requires synchronous drivers.