confusing error message for in_

Issue #715 resolved
jek created an issue
>>> list(session.query(Broker).filter(Broker.id.in_([1](1))))
<class 'sqlalchemy.exceptions.SQLError'>: (ProgrammingError) You cannot execute SELECT statements in executemany(). u'SELECT brokers.id AS brokers_id, brokers.name AS brokers_name \nFROM brokers \nWHERE brokers.id = ? ORDER BY brokers.oid' [[1]([1)]

Really it would be nice if in_() just took a list instead of always having to unpack the_list you're using. (Or took a list as an alterative to args.) I almost never have occasion to use in_(1, 2, 3) outside of tests.

Comments (1)

  1. jek reporter

    from ticket #750

    Changed in 6bbc7dd157faf5b513852286ba656fa6723cd2d6. in_ now takes a sequence of values or a selectable as its argument. The old API of passing values as positional arguments still works but raises a deprecation warning.

    This should be much more rare now. Not sure how much more inspection could be done, e.g. in_([[1]([1),[2](2)]). The inner lists could be a perfectly valid type such as PGArray.

  2. Log in to comment