Skip to content

SQLAlchemy 1.4 statements with .in_ operator not compiled correctly #577

Open
@Askaholic

Description

@Askaholic

In SQLAlchemy version 1.4 they way statements using the .in_ operator are compiled was changed to enable better caching. However this means statements need to be compiled with additional compile args in order to render correctly. You can read about the change here:
https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#change-4645

The issue this manifests itself as:

stmt = select([my_table]).where(my_table.c.column.in_([1, 2]))

async with database.acquire() as conn:
    result = await conn.execute(stmt)
    
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[POSTCOMPILE_column_1])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions