0

My django application need to collect user data(name age country etc) based on his email domain( 'gmail' as in [email protected]).I wist to create a new table every time i encounter a new email domain. Can this be done in django ?

1 Answer 1

1

This is a bad idea. Your tables would all have the same structure. All of your data should be stored in a single table, with a domain column to keep the data separate. Why would you want a different table for each domain? Whatever reason you have, there's a better way to do it.

This idea goes against everything in the design of the relational database, and the Django ORM on top of it.

Sign up to request clarification or add additional context in comments.

7 Comments

So that data of a particular domain can be seperate ! and authentic !
@user1504247: I'm not sure what "authentic" means. For "portable", you can extract rows from your table and move the data somewhere else.
Authentic so that i can give permission to users to manipulate the data of a specific table only !
@user1504247: In a django app, you typically don't use db-level permissions to protect access to data. You use a single db user, and the Django app accesses the database using that db user. Then you implement access controls in the Django app.
Initially I was thinking of manually setting up new tables using django.db.connection to achieve the same ! But as you suggest this is a 'bad idea'. Are there absolutely no provision of doing this or a better solution(than having a single table !)?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.