Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Model relationships between domains. #22

Open
voyc-jean opened this issue Apr 8, 2020 · 3 comments
Open

[QUESTION] Model relationships between domains. #22

voyc-jean opened this issue Apr 8, 2020 · 3 comments

Comments

@voyc-jean
Copy link
Contributor

I would just like some clarity on this. The user guide states that UUID fields should be used for model relationships, and that Services should control the relationship between models.

If a relationship spans multiple tables, say: Book -> Author -> Organisation -> Address, does this mean we would need to execute 4 SELECT queries (through different APIs) if we want a Book's Address, aggregating the results similar to Django's prefetch functionality?

Thanks!

@phalt
Copy link
Owner

phalt commented Apr 8, 2020

If you have four separate domains and you have that requirement, then yes?
But what if you have that data structure normally with foreign keys and you're doing joins?
That also seems a bit obtuse.
I wonder if there is a more optimal way - creating a BookWithAddress that stores the values together so you're not doing expensive queries all the time, perhaps?

@abusquets
Copy link

But if you need the list of books (paginated), with the Author, ... and want to order the list by Organization.
I can't not see the way of do that.

@abusquets
Copy link

After reading little more about the matter. I think that a BookWithAddres using cqrs pattern is good choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants