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

sqlalchemy join returns results from first table only – Mysql

so this is my issue, I have the following tables: class ClientCampaings(Base): __tablename__ = 'client_campaign' campaign_id = Column(INTEGER, primary_key=True) client_id = Column(VARCHAR(50)) campaign_name = Column(VARCHAR(45)) campaign_status = Column(VARCHAR(45)) campaign_type = Column(VARCHAR(45)) registration_date = Column(DATE) class ClientKpi(Base): __tablename__ = 'client_kpi' kpi_id…

VIEW QUESTION

Querying over PostgreSQL JSONB column

I have a table "blobs" with a column "metadata" in jsonb data-type, Example: { "total_count": 2, "items": [ { "name": "somename", "metadata": { "metas": [ { "id": "11258", "score": 6.1, "status": "active", "published_at": "2019-04-20T00:29:00", "nvd_modified_at": "2022-04-06T18:07:00" }, { "id": "9251",…

VIEW QUESTION
Back To Top
Search