#24632: PostgreSQL table inheritance
-------------------------------------+-------------------------------------
     Reporter:  Yennick Schepers     |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  contrib.postgres     |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  orm postgresql       |             Triage Stage:  Accepted
  table-inheritance inheritance      |
  object-relational                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Based on the above discussions I think it might be better to invest time
 in adding an entry point in how Django model inheritance is represented at
 the database level rather then focusing on getting PostgreSQL multi-table
 inheritance working by default which would be highly backward
 incompatible.

 It would be large undertaking but an API along the following lines would
 be interesting.

 {{{#!python
 from django.db.models.inheritance import single_table_inheritance  #
 default is MTI
 from django.contrib.postgres.inheritance import builtin_inheritance,
 partition_inheritance

 class Event(models.Model):
     datetime = models.DateTimeField()

 class SportEvent(Event, inheritance=builtin_inheritance):
     pass

 class Event2020(
     Event, inheritance=partition_inheritance(
         field='datetime',
         range=(datetime(2020, 0, 0), datetime(2021, 0, 0)),
     ):
     pass

 class STIEvent(models.Model, inheritance=single_table_inheritance):
     pass
 }}}

 That would allow different inheritance models to be used and implemented
 in third-party applications while maintaining support for the current
 abstract, proxy, and MTI based inheritance scheme.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/24632#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.ee6b6b271ea67ea89652a4020de9f32b%40djangoproject.com.

Reply via email to