'Using JOINS with Supabase when no FK is present

I am running into issues with my querying when using supabase. I have this query which I can use successfully in DataGrip

SELECT
    sja.audience_id,
    sja.segment,
    relation,
    sjac.constraint_id,
    sjac.constraint_value,
    sjac.targeting
FROM signal_journey_audience_constraint_relations
JOIN signal_journey_audiences sja ON signal_journey_audience_constraint_relations.audience_id = sja.audience_id
JOIN signal_journey_audience_constraints sjac ON signal_journey_audience_constraint_relations.constraint_id = sjac.constraint_id

But when using supbase I can an error

async function getTableData() {
    const { data, error } = await supabase.from(
      'signal_journey_audience_constraint_relations'
    ).select(`
    audience_id:signal_journey_audiences(audience_id),
    segment:signal_journey_audiences(segment),
    relation,
    constraint_id:signal_journey_audience_constraints(constraint_id),
    constraint_value:signal_journey_audience_constraints(constraint_value),
    targeting:signal_journey_audience_constraints(targeting)
    ),
    `);

    if (data) {
      console.log(data);
      setTableData(data);
    } else {
      console.log(error);
    }
  }

Error is

hint: Verify that 'signal_journey_audience_constraint_re…ship was created, try reloading the schema cache.

message: Could not find a relationship between 'signal_journey_audience_constraint_relations' and 'signal_journey_audience_constraints' in the schema cache

I am getting confused to why I can run the query in DataGrip but not in Supbase. I'm 90% sure I just have some syntax issue but can't figure it out.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source