alex wrote:
> ok, and what about {1:{"id":"1","name":"Alex"},2:
> {"id":"2","name":"Nick"}} format?
>
> I try to
> i=0
> result = list()
> for row in session.query(...).all():
> d = row.__dict__.copy()
> del d['_sa_instance_state']
> result.append(i)
> result.append(d)
> i = i
ok, and what about {1:{"id":"1","name":"Alex"},2:
{"id":"2","name":"Nick"}} format?
I try to
i=0
result = list()
for row in session.query(...).all():
d = row.__dict__.copy()
del d['_sa_instance_state']
result.append(i)
result.append(d)
i = i + 1
but it gives
{ 1, {"id":"1","n
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 25.03.2009 7:17 Uhr, alex wrote:
> sorry, but I need numeric of dicts {1:{"id":"1","name":"Alex"},2:
> {"id":"2","name":"Nick"}} to use this in ajax-call
JSON does not know about date-ish types. You have to convert such
fields explicitly e.g. to a
sorry, but I need numeric of dicts {1:{"id":"1","name":"Alex"},2:
{"id":"2","name":"Nick"}} to use this in ajax-call
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send emai
Thanks, it gets results. But I have an error "TypeError:
datetime.datetime(2009, 3, 11, 9, 56, 6) is not JSON serializable"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, se
It gets result - first row. But I have an error "TypeError:
datetime.datetime(2009, 3, 11, 9, 56, 6) is not JSON serializable"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 24.03.2009 13:45 Uhr, alex wrote:
> Hello.
>
> I need to get query from sqlalchemy in json format.
>
> query like
> query_name = session.query(model.Users);
>
> How to format like
> {{"id":"1","name":"Alex"},{"id":"2","name":"Nick"}.}
Th