Using alias() for 'select as' in SQLAlchemy
You actually want the label
method.
result = dbsession.query(Shares.price, \ func.sum(Shares.quantity).label("Total sold")) \ .filter(Shares.company== 'Google') \ .group_by(Shares.price).all()