Skip to content

[Bug]: Specifying custom async_engine and db_schema in Memory.from_defaults causes db_schema to be ignored #20746

@GinkREAL

Description

@GinkREAL

Bug Description

In SQLAlchemyChatStore's _setup_tables function, it ignores the db_schema value if it checks is_sqlite_database() to be true. This function checks if the async_database_uri starts with "sqlite".

However, if a async_engine is passed instead of async_database_uri, the default value does start with "sqlite". This causes the db_schema to be ignored.

Workaround is to pass whatever to async_database_uri to fix it.

memory = Memory.from_defaults(
    session_id="chat_id",
    table_name="conversations",
    async_database_uri="fake placeholder",
    async_engine=my_async_engine,
    db_schema="llama",
)

Related PR: !19741

Version

0.14.10

Steps to Reproduce

Create Memory passing both db_schema and async_engine, without passing in async_database_uri

memory = Memory.from_defaults(
    session_id="chat_id",
    table_name="conversations",
    async_engine=my_async_engine,
    db_schema="llama",
)

Relevant Logs/Tracbacks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs to be triaged/prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions