Skip to content

compile_query fails with sqlalchemy 1.4 #114

Description

@trvrmcs

This works fine with asyncpgsa version 0.27.1 and sqlalchemy: 1.3.23, but fails when I upgrade to sqlalchemy 1.4.4.

import asyncpgsa
import sqlalchemy as sa

Thing = sa.Table("thing", sa.MetaData(), sa.Column("name", sa.Text))
query = Thing.insert().values(name="name").returning(Thing)
asyncpgsa.compile_query(query)

This prevents me from running any code that uses an INSERT statement.

The error seems to be here:

https://github.com/CanopyTax/asyncpgsa/blob/master/asyncpgsa/connection.py#L36

    if isinstance(query.parameters, list):

because sqlalchemy.sql.dml.Insert no longer has a parameters attribute.

For now I'm dealing with this by pinning to an earlier sqlalchemy version. It's not clear to me what the fix should be, because the sqlalchemy internals seem to have changed considerably between versions.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions