Thanks for the answer Mike. If I understand right, what you mean is to have at the base-most level (Page in this case) the polymorphic on, and each child, grandchild class having a specific value for that discriminator? So let say the discriminator is page_type, each class can put the string there with its name, for instance, Event will put 'event', travel will put 'travel' and so on?
On Thursday, August 22, 2019 at 5:00:15 PM UTC+2, Mike Bayer wrote: > > That particular idea is a convenience but is never necessary to get a > multiple-level inheritance model to work. You simply have the > polymorphic_on in the base-most table be the place where the discriminator > is stored, and each descendant class defines its discriminator value fully. > > > > On Thu, Aug 22, 2019, at 10:39 AM, Javier Martínez wrote: > > In deed I am trying to follow this idea: > https://groups.google.com/d/msg/sqlalchemy/ij10zJ4hOv8/5YQDDkwJ2wUJ > > On Thursday, August 22, 2019 at 3:28:34 PM UTC+2, Javier Martínez wrote: > > Hi everyone, > > here again to look for some advice and wise suggestions. > > I am facing a situation that I thought I have already covered, but during > the testing phase (with real data) was not the case. So I have the > relationship between entities that you can see in the diagram below. I have > started using the next hierarchy: > > Base ->Page->(Tag and Product)-> (TravelPass and Travel) -> (Event, > Privatebooking) > > In each one of this extends I have used the 'polymorphic_on' to work with > a Joined Inheritance format. So reading more carefully the docs I realized > that this is not possible and in deed I had problems when querying the > TravelPass entity getting the results of > the Travel entity. So right now I am looking for alternatives to implement > this but I am a bit lost. I think the single table format will not solve > it. I am thinking about using regular relationships for making it works, > but so far no great > ideas come to my mind. I would like to ask for your advice in this topic. > Thanks in advance. > > > [image: Screenshot 2019-08-22 at 15.16.39.png] > > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > 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 [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/143c780c-2e3a-4634-84fb-537363f95051%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/143c780c-2e3a-4634-84fb-537363f95051%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/928134ab-5711-468d-87b4-606fd6e942b3%40googlegroups.com.
