Skip to content

Conversation

@romain-dartigues
Copy link
Contributor

Trying to adapt to SQLAlchemy breaking changes,
with the first 1.4 version permitted by dependencies:

zope-sqlalchemy==3.1 depends on one of:
    sqlalchemy>=1.1,<1.4.0
    sqlalchemy>1.4.6

There are a lot of breaking changes…

Refs: #1966, #1958

Trying to adapt to SQLAlchemy breaking changes,
with the first 1.4 version permitted by dependencies:

    zope-sqlalchemy==3.1 depends on one of:
        sqlalchemy>=1.1,<1.4.0
        sqlalchemy>1.4.6
@romain-dartigues romain-dartigues marked this pull request as draft March 23, 2025 18:03
…se use the .scalar_subquery() method to produce a scalar subquery.
…ent(s) "users.user" and FROM element "users.token". Apply join condition(s) between each element to resolve.
…'t adapt type 'Row'

The error:

    [SQL: SELECT guidebook.history_metadata.id, guidebook.history_metadata.user_id, guidebook.history_metadata.comment, guidebook.history_metadata.written_at
    FROM guidebook.history_metadata
    WHERE guidebook.history_metadata.id IN (%(id_1_1)s, %(id_1_2)s)]
    [parameters: {'id_1_1': (11,), 'id_1_2': (12,)}]
    (Background on this error at: http://sqlalche.me/e/14/f405)

In this case, it is related to:

    So this is the psycopg2 driver being given the value (1, ),
    a one-element tuple, as a parameter that is ultimately bound to a SQL
    string given the way that psycopg2 binds parameters.
    psycopg2 seems to just accept tuples and silently flattens them into
    their lone element, unless you pass more than one element:
    [...]
    unfortunately psycopg2 is simply wrong here and your program has been
    relying on a driver bug

    — sqlalchemy/sqlalchemy#9214 (reply in thread)
…ad operation of attribute 'document_id' cannot proceed (Background on this error at: http://sqlalche.me/e/14/bhk3)

This is a workaround as I was unable to fix it in another way (either through `sqlalchemy.orm.undefer` or eager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant