[sqlalchemy] is it two or more levels of polymorphism possible?
hi all, i was wondering if there's a way to create more than one level of polymorphic entities in sa. quick example: class Foo(Base): ... __mapper_args__ = { ... } class Bar(Foo): ... __mapper_args__ = { ??? } # --- polymorphic_identity for ... two? class Baz(Bar): # --- is this possible? ... cheers, Richard. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. attachment: richard.vcf
Re: [sqlalchemy] is it two or more levels of polymorphism possible?
On 7/15/15 9:09 AM, Richard Gerd Kuesters wrote: hi all, i was wondering if there's a way to create more than one level of polymorphic entities in sa. quick example: class Foo(Base): ... __mapper_args__ = { ... } class Bar(Foo): ... __mapper_args__ = { ??? } # --- polymorphic_identity for ... two? class Baz(Bar): # --- is this possible? ... yes, you give a new polymorphic_identity to Baz separate from Bar. The only requirement is that they are all using the same column on Foo for the differentiation (cascading polymorphic_on columns isn't supported yet). cheers, Richard. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] is it two or more levels of polymorphism possible?
oh, yes, i was thinking about cascading polymorphic_on, like you mentioned. but, no problem, i'll try to workaround my problem with a more simple approach (the old soft-delete dilemma) ... thanks for your help, Mike! best regards, richard. On 07/15/2015 10:46 AM, Mike Bayer wrote: On 7/15/15 9:09 AM, Richard Gerd Kuesters wrote: hi all, i was wondering if there's a way to create more than one level of polymorphic entities in sa. quick example: class Foo(Base): ... __mapper_args__ = { ... } class Bar(Foo): ... __mapper_args__ = { ??? } # --- polymorphic_identity for ... two? class Baz(Bar): # --- is this possible? ... yes, you give a new polymorphic_identity to Baz separate from Bar. The only requirement is that they are all using the same column on Foo for the differentiation (cascading polymorphic_on columns isn't supported yet). cheers, Richard. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. attachment: richard.vcf