我想知道如何使用不带Flask扩展名但具有在模板中吸引值(结果)的选项的SQLalchemy组成如下所示的请求:
// Quiet different sign-ness warnings
int length_needed = snprintf(... as above ...);
if (length_needed < 0 || (unsigned) length_needed >= sizeof buf) {
fprintf(stderr, "Buffer too small");
exit(EXIT_FAILURE);
}
我想写同样的请求,就像我可以通过SQLAlchemy(在下面写到)一样,没有Flask扩展。
class Finance(db.Model):
__tablename__=='MAIN'
id = db.Column(db.Integer, primary_key=True)
month = db.Column(db.Integer)
cost_with_vat = db.Column(db.Integer)
profit = db.Column(db.Integer)
需要在模板中显示结果
profit = select([func.sum(order.columns.profit)])
profit = profit.where(or_(
order.columns.cost_with_vat>0,
order.columns.cost_with_vat=='?'))
profit_month = profit.where(order.columns.month==11)
result = connection.execute(profit_month).scalar()