python - SQLAlchemy add columns to query() on mapped class -


i'm wanting pagination, i'm using postgresql. avoid doing query twice, i'm using feature described @ https://stackoverflow.com/a/8242764

how can add full_count column list of columns fetched in query. can use query.add_columns, column not accessible after calling query.all()

is possible in sqlalchemy?

can provide original code query want augment? using sqlalchemy core or declarative orm? latter this:

from sqlalchemy import func  items = session.query(model, func.count().over().label('full_count')).all() obj = items[0].model count = items[0].full_count 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -