PricingDocsAcademy
Bluesky ...
Wed, Dec 11, 10:09 PM

SQL querie in Supabase

  • PeterShaw

    1 month ago

    Hey all, I use a SQL query in Supabase editor. How can I make sure to use this SQL query when fetching data from supabase?

    For example I use a table with 10 cities in it. The sql query says that the output is one random city. I want to integrate the SQL in the GET API call
  • Lucas G

    1 month ago

    API calls to supabase use PostgREST which is an API layer for Postgres. It doesn't have the ability to fetch a random item, only the standard filtering options are available
  • What you'll need is a function
  • Supabase supports RPC via this endpoint: rest/v1/rpc/
  • Lucas G

    1 month ago

    Create a database function, make sure it is safe to call it, and use the rpc endpoint to run it. The response will be the function's result
  • PeterShaw

    1 month ago

    Thanks Lucas

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.