Thursday, February 23, 2017

Re: Flattening model relationships (in APIs)

Also, I don't have any need of providing several types of addresses as of now. For now I'm just sticking with outputting everything when the address is requested.

~~ Ankush

On Thursday, February 23, 2017 at 9:13:01 PM UTC+5:30, Ankush Thakur wrote:
Hey Mike,

Thanks for your thoughts. Perhaps I presented my requirement incorrectly. I don't at all want to denormalize the database. My point was that because of the way models are related, I'm ending up with city containing state containing country. This, I feel, would be a chore for the front-end guys. So my question is, how can I rearrange these fields to give a flat JSON output rather than have objects within objects. I hope it makes more sense now.

~~ Ankush

On Wednesday, February 22, 2017 at 9:59:26 AM UTC+5:30, Mike Dewhirst wrote:
Ankush

I think you might have to provide more than one method for retrieving an
address so applications can request particular subsets. Perhaps a
local-postal address, international-postal address, geo-location,
what-three-words address and of course the full bucket as required.

I think it is always best to normalize as much as possible in the
beginning and de-normalize only if performance becomes an issue.

Also ...

https://hackernoon.com/10-things-i-learned-making-the-fastest-site-in-the-world-18a0e1cdf4a7#.3l8n34dvk

Mike

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e9db76fa-aabc-4546-a80c-af03087e3042%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment