python - how to paging from top 99 rows in sqlalchemy? -
select *from (select *from new_count_goods_details limit 99) sub limit 10 offset 90;
how achieve mysql statement sqlalchemy?
this code:
limit_subquery = q.filter(stylelist.add_time >= yesterday_18).\ filter(stylelist.add_time <= today_18).\ order_by(stylelist.rank_num.desc()).\ limit(99).\ subquery("limit_subquery") q = limit_subquery.offset((p-1)*ps).limit(ps)
it error code, error info: attributeerror: 'alias' object has no attribute 'offset'
you need select subquery
q = session.query(limit_subquery).offset((p-1)*ps).limit(ps)
Comments
Post a Comment