python - Does with_entities result in smaller objects? -
when need column values , don't need else provided model, use with_entities
, iterate on tuple-like sqlalchemy.util._collections.result
objects result.
am correct these objects smaller full-blown model objects otherwise getting?
example:
models = thing.query.filter_by(user_id=3).all() type(models[0]) # => project.models.thing # # vs # tuples = thing.query.with_entities(thing.id).filter_by(user_id=3).all() type(tuples[0]) # => sqlalchemy.util._collections.result
Comments
Post a Comment