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

Better docs to abandon prejudice #18

Open
guettli opened this issue Jun 10, 2014 · 2 comments
Open

Better docs to abandon prejudice #18

guettli opened this issue Jun 10, 2014 · 2 comments

Comments

@guettli
Copy link

guettli commented Jun 10, 2014

A thread[1] on django-devel showed, that there are fears of single table inheritance.

  • There is one table which holds all data.
  • STI reduces the database to key-value store
  • All values are nullable

AFAIK there are two tables for this:

class Animal(TypedModel):
    pass
class Canine(Animal):
    pass

class Fruit(TypedModel):
    pass
class Aple(Fruit):
   pass

It is very easy to make one column not nullable: Add a constraint which checks the type column and the column which should be not nullable. It could be implemented in django typed models to implemented this:

Pseudocode for constraint:

if type=="Aple":
    check color is not NULL

Thread on django-devel
https://groups.google.com/d/msg/django-developers/-UOM8HNUnxg/keyHsbGE6WgJ

@craigds
Copy link
Owner

craigds commented Jun 11, 2014

Sure thing. I'm pretty rubbish at writing docs unfortunately.

I replied to the thread. Will wait a bit to see if Russell KM replies, since I don't understand his key-value-store objection at all. Maybe he'll shed some light on his understanding of STI

@guettli
Copy link
Author

guettli commented Jun 11, 2014

Yes, the problem here is not technology. It is human fear. You don't need to care about 1M NULL values in columns. Modern databases handle this very well.

Related: Jacob Kaplan-Moss "Django gotcha: concrete inheritance" http://jacobian.org/writing/concrete-inheritance/

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

No branches or pull requests

2 participants