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

pentaho - Carte Status / Kettle Slave Server Status page shows status for random runs instead of the latest run -

R summary function in ddply (plyr) in a simple way -

c# - Are delegates created via lambda expressions guaranteed to be cached? -