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

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -