Holen Sie sich die erste Reihe Sqlalchemy

result = session.query(profile.name).filter(...).first()
if not result:
    print 'No result found'
# Alternatively you can use one(), which will give you the only item, 
# but raise exceptions for a query with zero or multiple results
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm.exc import MultipleResultsFound

try:
    user = session.query(User).one()
except MultipleResultsFound, e:
    print e
    # Deal with it
except NoResultFound, e:
    print e
    # Deal with that as well
Bug Killer