skip to Main Content

Null instead of null values in jsonb_build_object – Postgresql

I am trying to build query that gets data from 3 different tables using sqlalchemy I tried select( models.Animals.id, models.Animals.description, models.AnimalTypes.name.label('type'), func.coalesce( func.array_agg( func.jsonb_build_object( 'id', models.Animals.id ) ), None ).label('animals') ) .join(models.FamilyTypes, models.Family.id == models.Family.family_type_id) .outerjoin(models.Animals, models.Animals.campaign_id == models.Animals.id) .group_by(models.Family.id,…

VIEW QUESTION
Back To Top
Search