Just do it in Python:
res = []
for hpoint in session.query(HistoryPoint).all():
res.setdefault(hpoint.vehicle_id, []).append({'id':hpoint.id,'location':
str(hpoint.location)})
On Tuesday, September 22, 2015 at 6:48:14 PM UTC+3, Johnny W. Santos wrote:
>
> Supose I have the models below, how
Correction:
res = {}
for hpoint in session.query(HistoryPoint).all():
res.setdefault(hpoint.vehicle_id, []).append({'id':hpoint.id,'location':
str(hpoint.location)})
But it will yield a dict, not an array of single-value dicts as requested
(are you sure this is what you want? anyways, it's
Anyway thanks, it'll help a lot.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to
Yes, but I think this will be expensive to arrange it with python because I
need to return everything at once.
I though I could just group_by with some annotation, but I couldn't figure
out how.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To