def serialize ( self ) : data = { 'doc' : self . doc } if isinstance ( self . query , Query ) : data [ 'query' ] = self . query . serialize ( ) return data
flask python serialize databse query object
Serialize the query to a structure using the query DSL .
def serialize(self):
        """Serialize the query to a structure using the query DSL."""
        data = {'doc': self.doc}
        if isinstance(self.query, Query):
            data['query'] = self.query.serialize()
        return data