I'm trying to serialize this object, which is a result of a join between two tables:
query_response = [(<Company 2>, <Detail 1>), (<Company 3>, <Detail 2>)]
and I'm using this schema:
class CompanyCompleteSchema(Schema):
company = fields.Nested(CompanySchema)
detail = fields.Nested(DetailSchema)
companies_complete_schema = CompanyCompleteSchema(many=True)
Basically, I'd like to have one schema for the join query. I'm using:
data = companies_complete_schema.dump(query_response)
It doesn't work and I can't figure out the problem. It just returns:
[{}, {}]
Any suggestion is highly appreciated. Thanks.