Hey, I’m trying to filter JOIN statement in WeWeb’s Supabase Plugin.
I have a query like this in SQL
In Supabase I got this far
But when it comes to filtering, it is pretty tough,
Hey, I’m trying to filter JOIN statement in WeWeb’s Supabase Plugin.
I have a query like this in SQL
In Supabase I got this far
But when it comes to filtering, it is pretty tough,
Hey Rob,
There’s 2 things you can do here.
BUT : i don’t like this approach anymore (for perfs). So solution 2 :
I tend to create VIEWs in Supabase
create view myview as select * from table1 join table2 on…
and then use that view as a collection in WeWeb. That’s waaaay faster (according to me anyway).
I hope it helps.
Have a nice night.
Matth-
Hey Matthieu, thanks for your view on the topic
I’m not sure if I can go with views because they dont seem to support row level security. And as for the first proposal, I’m already joining tables with standard joins, but I’m unable to filter the joined result because it gives me back array and then the thitd screenshot happens, with an error also, which is not optimal either, as I can only access the array it seems.
I really appreciate your input though maybe @Alexis would know of a workaround
Basically I’m doing the first one you mentioned but the filter seems to not work on the joined array result, as it treats it as a column for some reason?
Yes they do actually.
If you created your view with the correct syntax, the view will only show what the table can display to your user through the RLS.
drop view public.myview;
create view public.myview with (security_invoker=on) as select………
So yes to views
As for the filters, I have sometimes troubles to filter collections in WeWeb when the first row is not filled with non null values.
I think you have to list what you want for all those tables instead of the stars.
employee_id,
name,
surname,
job: employee_id(job_id, date)
@Alexis seems like it treats the array as a column. It would be fantastic, if instead there were the joined columns, that would be super fantastic : )
Hmm, I might have to use views, but that is not really something I’d be wanting to do like always. As I also cannot filter them directly via a variable. But seems like the only viable option, security invoker is a new thing, isn’t it? Haven’t heard about it before
Edit: Seems like you were right and if this doesn’t get fixed somehow, views will be a good option. Thank you very much for the idea @Matthieu, could you elaborate on the performance concerns regarding the WeWeb “Advanced” WeWeb joins? I thought they were the same. I know there might be some JS behind it all, but in the end it is a call through SDK. Is it that the views are already “ready” there?
I think what is missing is the ability to select a subproperty, or type what you want like “job.date” as field instead of only job
We plan to explore this blocker for the next supabase update
For now I think the only solution is view as @Matthieu suggested
Edit : And for the warning message when putting * symbol in the field, its a false flag, we forgot to handle this case when checking your input
Hey, thanks for the answer! Is there any chance to see what features you have planned and the estimated date? You might want to post it here, so we can add some things that might be missing for us so you can consider adding them