Skip to content

Resource embedding with a one-to-one view #1895

Answered by steve-chavez
Schniz asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Schniz,

Looking at the documentation, seems that embedding views should work. Why would that be? Am I doing something wrong?

Yes, embedding views work as long as there are foreign key relationships on the tables it's based on.

The derived_avatars view is basically the profiles table underneath, and there's no foreign key relationship between profiles and profiles - so it's not really a one-to-one relationship.

For this case, you could make a VIEW of the users table(hiding some columns), say my_users, and then you should be able to embed profiles with my_users(/profiles?select=*,my_users(*)).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@steve-chavez
Comment options

@Schniz
Comment options

Answer selected by steve-chavez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants