Supabase filter by joined tables

Hey, I need to filter by joined table.

In this case I would like to filter by contact name


image

Anyone has idea how to get ‘in’ to the object data?

This is a current limitation of weweb’s supbase plugin. I’ve already discussed it here. But I also found a solution, you can’t bind properties tho.

@Alexis this could be a hotfix, if you enabled binding in custom fields selection.

If you dont need to bind your values, you can follow the PostgREST docs. I did this before, it is a pain in the ass, but it works. It’s just very prone to fail due to typos. Section Embedded Filters

https://postgrest.org/en/stable/references/api/resource_embedding.html

Edit: you can solve this simply by creating a view and fetching it. You create a join view in SQL and then you can filter that, and also bind properties.

3 Likes

By the way you cannot work with realtime and joins. Because the Supabase Realtime doesnt work on Joined tables. It only will reflect changes of the main table. Also the old SDK is very weak in terms of Realtime, so hopefully we get a sweet update soon.

Edit: For the joins, if you feel adventurous, you can also tap into the Supabase SDK via code and call whatever you want with code. Be careful to use the docs to the old version of SDK v1

3 Likes

Thank you!

1 Like