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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -