Yes, it works, now! Thanks a lot, Jonathan j
Il giorno giovedì 20 novembre 2014 19:35:03 UTC+1, Jonathan Vanasco ha scritto: > > SqlAlchemy returns "column" results as a `KeyedTuple`. It's similar to > `collections.namedtuple` in the standard library > > Looking at your code, my guess is that you had something like this: > > ids = session.query(Model.id).filter(...).all() > > and are then passing those ids into a query like this: > > objects = session.query(Model).filter(Model.id.in_(ids)).all() > > if that's the case, your code needs to look like this: > > # sqlalchemy returns a tuple on column queries, even for 1 item > results = session.query(Model.id).filter(...).all() > # grab the first element of each tuple > ids = [i[0] for i in results] > # now you have Integers to work with > objects = session.query(Model).filter(Model.id.in_(ids)).all() > > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.