]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
this example doesn't work, we don't really have a solution for this as far as automat...
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Feb 2014 22:43:37 +0000 (17:43 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Feb 2014 22:43:37 +0000 (17:43 -0500)
lib/sqlalchemy/ext/declarative/__init__.py

index 0ee4e33fd4a2d81ee125b5857309305c0aa2a11a..e878e362da0164ae328d9049f98db2172d0a8a8e 100644 (file)
@@ -1122,37 +1122,6 @@ inheritance::
         primary_language = Column(String(50))
         __mapper_args__ = {'polymorphic_identity': 'engineer'}
 
-If you want to use a similar pattern with a mix of single and joined
-table inheritance, you would need a slightly different mixin and use
-it on any joined table child classes in addition to their parent
-classes::
-
-    from sqlalchemy.ext.declarative import declared_attr
-    from sqlalchemy.ext.declarative import has_inherited_table
-
-    class Tablename(object):
-        @declared_attr
-        def __tablename__(cls):
-            if (has_inherited_table(cls) and
-                Tablename not in cls.__bases__):
-                return None
-            return cls.__name__.lower()
-
-    class Person(Tablename, Base):
-        id = Column(Integer, primary_key=True)
-        discriminator = Column('type', String(50))
-        __mapper_args__ = {'polymorphic_on': discriminator}
-
-    # This is single table inheritance
-    class Engineer(Person):
-        primary_language = Column(String(50))
-        __mapper_args__ = {'polymorphic_identity': 'engineer'}
-
-    # This is joined table inheritance
-    class Manager(Tablename, Person):
-        id = Column(Integer, ForeignKey('person.id'), primary_key=True)
-        preferred_recreation = Column(String(50))
-        __mapper_args__ = {'polymorphic_identity': 'engineer'}
 
 Combining Table/Mapper Arguments from Multiple Mixins
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~