Fix: add missing kwargs to db session service

Copybara import of the project:

--
bbd21e72e46227d5bbcaef6601f4a81724e7829f by Sanchit Rk <sanchitrrk@gmail.com>:

Fix: add missing kwargs to db session service
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/946 from sanchitrk:fix/missing-kwargs-db-session-service ebb699b04d8420ad14244cf3d43a2982b01d6b7f
PiperOrigin-RevId: 764392251
This commit is contained in:
Sanchit Rk 2025-05-28 13:27:23 -07:00 committed by Copybara-Service
parent 2a07eefc27
commit 3cd4cd3ecf

View File

@ -240,14 +240,14 @@ class StorageUserState(Base):
class DatabaseSessionService(BaseSessionService): class DatabaseSessionService(BaseSessionService):
"""A session service that uses a database for storage.""" """A session service that uses a database for storage."""
def __init__(self, db_url: str): def __init__(self, db_url: str, **kwargs: Any):
"""Initializes the database session service with a database URL.""" """Initializes the database session service with a database URL."""
# 1. Create DB engine for db connection # 1. Create DB engine for db connection
# 2. Create all tables based on schema # 2. Create all tables based on schema
# 3. Initialize all properties # 3. Initialize all properties
try: try:
db_engine = create_engine(db_url) db_engine = create_engine(db_url, **kwargs)
except Exception as e: except Exception as e:
if isinstance(e, ArgumentError): if isinstance(e, ArgumentError):
raise ValueError( raise ValueError(