[sqlalchemy] Re: sqlalchemy and json

2009-03-26 Thread Don Dwiggins
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

[sqlalchemy] Re: sqlalchemy and json

2009-03-26 Thread alex
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

[sqlalchemy] Re: sqlalchemy and json

2009-03-25 Thread Andreas Jung
-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

[sqlalchemy] Re: sqlalchemy and json

2009-03-25 Thread alex
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

[sqlalchemy] Re: sqlalchemy and json

2009-03-25 Thread alex
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

[sqlalchemy] Re: sqlalchemy and json

2009-03-25 Thread alex
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,

[sqlalchemy] Re: sqlalchemy and json

2009-03-24 Thread Andreas Jung
-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