why can not support sqlalchemy list object to json?

Issue #3672 closed
Ramin Farajpour Cami created an issue

I got tired,i have class model for convert json but not work any things for this,because i have relationship on my model , why there is not any function for convert list object for convert json in sqlalchemy?

class sample(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

Comments (2)

  1. Mike Bayer repo owner

    Hello -

    JSON serialization is a concern outside of SQLAlchemy itself which is only concerned with mapping things to databases. There are many JSON serializer libraries for Python objects, but there are also some specific to SQLAlchemy such as alchemyjsonschema which will give you a JSON schema that can help with rendering as JSON, as well as SQLAlchemy-JSONAPI which renders SQLAlchemy-mapped objects straight to JSON.

  2. Log in to comment