[sqlalchemy] Re: How to jsonify Query result?

2015-07-15 Thread sector119
Ok, that approach isn't cool.. I get another one from flask_jsontools and it does what I need! json.dumps(q, cls=DynamicJSONEncoder) Base = declarative_base(cls=JsonSerializableBase) import decimal from datetime import datetime, date from json import JSONEncoder from sqlalchemy import

[sqlalchemy] Re: How to jsonify Query result?

2015-07-14 Thread sector119
I create Serializer class and use it for all my models with: Base = declarative_base(cls=Serializer) But I have one problem! I have Organization model and Service model that has organization = relationship('Organization', backref='services') relationship and I get RuntimeError: maximum

[sqlalchemy] Re: How to jsonify Query result?

2015-07-13 Thread Jonathan Vanasco
The tuples are a variant of python's NamedTuple (sqlalchemy.utils._collections.KeyedTuple) and contain the column names in a `keys` method. You can just write a json adapter that handles instances of KeyedTuple and iterates over their K/V pairs. -- You received this message because you are