SQLAlchemy returns tuple not dictionary

Posted by Ivan on Stack Overflow See other posts from Stack Overflow or by Ivan
Published on 2010-05-13T15:54:54Z Indexed on 2010/05/17 11:20 UTC
Read the original article Hit count: 283

Filed under:
|

Hi everyone,

I've updated SQLAlchemy to 0.6 but it broke everything. I've noticed it returns tuple not a dictionary anymore. Here's a sample query:

query = session.query(User.id, User.username, User.email).filter(and_(User.id == id, User.username == username)).limit(1)
result = session.execute(query).fetchone()

This piece of code used to return a dictionary in 0.5.

My question is how can I return a dictionary?

© Stack Overflow or respective owner

Related posts about python

Related posts about sqlalchemy