Model Design

34 views
Skip to first unread message

dtdave

unread,
May 5, 2022, 9:36:16 AM5/5/22
to Django users
We receive data from various third parties in their proprietary format in excel. We then import this into our database and our models have been designed around their format.
There is no option to change the way this data is received.
However, we now need to add an account manager to this data and under normal circumstances this would be a case of adding a foreign key to the data.

What would be the best method of dealing with this given that we cannot change the format of the data we receive nor the current models given that they mirror this structure.
One suggestion has been to use a generic foreign key but I am not sure how this would work.

Thanks in advance


Agnese Camellini

unread,
May 5, 2022, 9:41:19 AM5/5/22
to django...@googlegroups.com
i would decouple the importing of data from the database architecture, and make a meaningfould structure of the models, but your own, not the one of the client. In this manner you create a design that is meaningful and can be scaled from the knowledge expressed in the data without being dependant from the logic of the client, that can change and is not reliable for an application architecture..
My 2 cents
Agnese

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/97d1988f-b230-46a8-93dc-be583860467an%40googlegroups.com.

Ayser shuhaib

unread,
May 5, 2022, 9:52:12 AM5/5/22
to django...@googlegroups.com

To help understand more the problem, would you please explain why adding an extra field to your models to be used as a foreign key, is not an option?

David Turner

unread,
May 5, 2022, 10:00:14 AM5/5/22
to django...@googlegroups.com
We receive the data every two weeks and then use django-import-export to import the data into our database. There is no mention of the account manager in these as this is something on our side. Am I missing the point in that by having the foreign key to the account manager this would impact on the import?

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/bLKn2Dm15sU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE0AZGKB5Mj5%3DFfuHVAASVG-GU3i7Opc1OsxySy_C9A3y0axeA%40mail.gmail.com.

Ayser shuhaib

unread,
May 5, 2022, 10:03:54 AM5/5/22
to django...@googlegroups.com
It shouldn’t impact cause you can set that field to be (blank=True, null=True) in this case it won’t raise an error and you can attach the imported data to the related account manager. 
This is how I see it I hope this helps

David Turner

unread,
May 5, 2022, 10:10:25 AM5/5/22
to django...@googlegroups.com
Thanks for this just tried that and everything works fine. I think I just had a mental block!

Best

Lunga Baliwe

unread,
May 6, 2022, 6:20:36 AM5/6/22
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages