Thanks, but not work, very very bad sqlalchemy in this,i have relstionship not work
class Student(Base): __tablename__ = 'reltest' id = Column(Integer, primary_key=True) name = Column(String(50)) fullname = Column(String(50)) password = Column(String(50)) parent_id = Column(Integer, ForeignKey('reltest.id'),index=True) children = relationship(lambda: Student, remote_side=[id]) hashid = None how to use this for convert list object to json? On Monday, March 7, 2016 at 2:42:54 PM UTC+3:30, Ramin Farajpour Cami wrote: > > I use jsonpickle for serializer when i selectall to database, i am going > to convert list object to json when use jsonpickle for this i get this > output: > > Codes: > > > Session = sessionmaker(bind=connect.ConnectorMySql()) > ses = Session() > lst = ses.query(pModel).all() > return lst > > > jsonpickle: > > serialized_obj = jsonpickle.encode(lst[0]) > > > output: > > {"py/object": "Models.UserModel.", "sa_instance_state": {"py/object": > "sqlalchemy.orm.state.InstanceState", "py/state": {"instance": {"py/id": 0}, > "committed_state": {}, "class": {"py/type": "Models.UserModel."}, "manager": > {"py/object": "sqlalchemy.orm.instrumentation.SerializeManager", "class": > {"py/type": "Models.UserModel.Student"}}, "key": {"py/tuple": [{"py/type": > "Models.UserModel.Student"}, {"py/tuple": [1]}]}, "expired_attributes": > {"py/set": []}}}, "name": "ramin", "fullname": "eee", "password": "1234345", > "id": 1} > > > but i need this format json: > > {"name": "ramin", "fullname": "eee", "password": "1234345", "id": 1} > > > do you idea better for this work? > > -- 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 sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.