JSON data filters with Supabase

  • saillmone-1305865587284508752

    saillmone

    5 months ago

    Hi everyone !

    I have filter problems with JSON data with supabase.

    I'm trying to push supabase a little further than a simple table but I'm finding myself having difficulty.

    My API call without filter returns me the data. But as soon as I want to make a filter on the JSON "collections", impossible. I have a status code 200 but an empty response.


    "products_collections_variants?select=title,collections&collections->>slug=eq.incontinence"

    Can anyone guide me?

    Thank you!
    1305865587750342748-image.png
    1305865587997544468-image.png
    1305865588270170223-image.png
  • Tod-1305865590648344597

    Tod

    5 months ago

    Great energy @saillmone! Your continuous contribution to the toddle Community just made you advance to Community Level 1!
  • saillmone-1305914956272762911

    saillmone

    5 months ago

    I thought maybe I had to pass an Edge Functions to make the javascript calls directly but I got exactly the same result: empty data without error code.

    If anyone has had this problem or can answer me, I'm interested, thank you! πŸ™Œ
  • stuster-1305951461120806963

    StuartM

    5 months ago

    I see two things.
    1. You need to put the query separately from the select. Something like this products_collections_variants?and=(collections->>slug.eq.incontinence)&select=*
    2. You have an array in your collections field so if that is expected you need to target a particular item/index in the json path.

    Now for the plug - I figured this out by building a query visually in Comnoco and then seeing what it constructed by looking at the debug logs.
    1305951460655366174-image.png
    1305951461074534441-image.png
  • saillmone-1306000688634925126

    saillmone

    5 months ago

    Thanks for your feedback, i’m now able to get the correct data !

    I just took a look at comnoco (good job). If I understand correctly its usefulness, it is to facilitate api calls to supabase? what about the response time?
    πŸ‘1
  • stuster-1306014594556235786

    StuartM

    5 months ago

    It's a backend visual language so it allows you to build visual logic, APIs, scheduled tasks etc and connect to any database. Like Xano but made to work with any database and auth.
    You don't need a backend to do simple CRUD calls to Supabase protected by RLS, Comnoco is for backend logic - like a visual way to build logic and secure API connectivity instead of edge functions.
  • saillmone-1306205954403995739

    saillmone

    5 months ago

    I just succeeded by creating database functions and calling them via API...

    Thank you for your feedback (I'll keep an eye on comnoco, the day there are more docs it will be crazy!)
  • stuster-1306222724913430559

    StuartM

    5 months ago

    Oh cool, well done, as you pointed out, a few more docs and videos will help a lot, they are coming!
    πŸ”₯1
  • yoelfdz-1306224613348474881

    yoelfdz

    5 months ago

    Hey @saillmone ! I wish I discovered Comnoco sooner, it's definitely worth checking out especially if you're coming from Toddle. There are many similarities, and the trifecta of Toddle, Comnoco, and Supabase is πŸ‘ŒπŸΌ. Would be happy to connect and share insights on this if you decide to use it
    πŸ”₯1
    ❀️1

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.