supabase-py icon indicating copy to clipboard operation
supabase-py copied to clipboard

Cannot chain multiple ilike or filter with ilike

Open harshdeep-techstax opened this issue 9 months ago • 6 comments

Unable to chain multiple ilike like this

supabase.table("products").select("*", count='exact').filter("name","ilike",f"%KitKat%").filter("category","ilike",f"%Candy Bar%").order(sort).limit(limit).execute()

Getting error like image

harshdeep-techstax avatar May 03 '24 07:05 harshdeep-techstax

That's a Cloudflare error, maybe the service was down at the time you tried this. Try again and let me know the result.

silentworks avatar May 06 '24 13:05 silentworks

Still getting the same error on single ilike as well image

harshdeep-techstax avatar May 09 '24 20:05 harshdeep-techstax

Please check if your project is paused in the Supabase dashboard.

silentworks avatar May 10 '24 22:05 silentworks

I am also getting those errors when using any kind of filtering (even on unchained fitlers), like:

  • ilike
  • like
  • filter

One operation that works is eq. Using version 2.4.5

FBosler avatar May 14 '24 10:05 FBosler

The % in the built query is causing your error, as the % is used for url encoding. Use * instead.

regtm avatar May 15 '24 13:05 regtm

The % in the built query is causing your error, as the % is used for url encoding. Use * instead.

Yeah adding * instead of % worked.

harshdeep-techstax avatar May 16 '24 13:05 harshdeep-techstax

I finally got around to testing this out and cannot replicate the issue you are both facing. I also looked in the postgrest repo and notice there are tests to make sure these methods were tested correctly. Here is a video I created demonstrating that this is working in my codebase.

https://github.com/supabase-community/supabase-py/assets/79497/c9074010-8c73-4356-a3e8-4ce634bd1632

silentworks avatar May 21 '24 21:05 silentworks

@silentworks can you try chaining multiple ilikes as single ilike is working. I said multiple ilike chaining for example select().ilike("title","%Home%").ilike("description","%father%").

It is now working when I replace % with *

harshdeep-techstax avatar May 22 '24 11:05 harshdeep-techstax

@harshdeep-techstax Its the same results for me with either single of multiple chaining ilikes.

https://github.com/supabase-community/supabase-py/assets/79497/2f1c360e-15ba-4f90-abe6-ee41021a82f4

silentworks avatar May 22 '24 20:05 silentworks

Closing as this is no longer an issue as demonstrated by the video in the previous comment.

silentworks avatar Jun 07 '24 08:06 silentworks

Having the same problem, looks like the fix works

nosnatef avatar Jun 08 '24 03:06 nosnatef