Hi guys, new to supabase. I have a table of profil...
# help
k
Hi guys, new to supabase. I have a table of profiles and one of my columns, 'ownedItems', is an array of JSON objects. I want to retrieve the rows from this table if a value, namely 'itemAddress', in the any of JSON objects in the array matches a parameter 'redeemedItemAddress' that I pass in. Any suggestions on how to do this?
n
Hello @kirk douglas! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
You will have to do it with a rpc call and function using postgres sql. I don't know how complicated it would be on an array of json. https://www.postgresql.org/docs/9.5/functions-json.html There could be an operator/function that works there. Probably look thru that and then ask in SQL section or google postgres for ideas.
k
So I'm guessing I'd use the SQL editor to define a specific query for this task and the API would export this query to allow me to use it in my javascript repo?
g
You write a postgres function/procedure and then it will "appear" in the API and you can call it using .rpc
If you are returning multiple rows then you will need to use the SQL editor rather than the UI function editor so you can return "setof profiles"