https://supabase.com/ logo
I have the tables.. `reports` `bonds` `report_bon...
# help
e
I have the tables..
reports
bonds
report_bonds
Reports are basically just a list of bonds, or a list of documents. In my UI I want to display specific bond information. I know that instead of running another function, I can use something like this...
Copy code
js
  const { data: report, error } = await supabase
    .from("reports")
    .select("*, report_bonds(*)")
    .eq("id", params.id)
    .single();
... in hopes that it will give me back a nested obj containing all the
bond
information / details to render to my UI. But, I get the error,
Could not embed because more than one relationship was found for 'reports' and 'reports_bonds'
It is true that my
reports_bond
table has 2 FK,
bond_id
and
report_id
( I need both ). I have looked for answers online and in the documents but I cannot seem to get anything to work. I even tried removing 1 of the 2 FKs in the
report_bond
table, but I still get the same error
Any ideas on how I can go about this ?
n
Hello @Ethanxyz! 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
For a single fk from my test table to my messages table, I can do this:
Copy code
.from('messages')
.select('*,test(*)'
.eq('id',7)
and I get my message id = 7 and 3 rows from test with a fk of 7 pointing to the message table. So the reason the single key may not work is you have to flush the schema cache.
Copy code
select('*, test!message_id(*)')
seems to work... ! is a hint to the correct fk to use. Note I only tested the syntax on a single key, but this probably will work.
e
thank you for the response let me try that out
This works for my needs, thanks ! I did see the
!
mentioned in other post but I was using it wrong.