Re: [sqlalchemy] Re: Advice on cascading polymorphic inheritance

2019-08-23 Thread Javier Martínez
Sorry, the code was too big, so I leave here the file. -- 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 d

Re: [sqlalchemy] Re: Advice on cascading polymorphic inheritance

2019-08-23 Thread Javier Martínez
Thanks Mike. Just in case, I found some dificulties working with it, so despite the code is long, it could help someone in the community or open interesting discussions, so I leave it below. Thanks again. import uuid import json import datetime from src.common.helpers import format_date_TZ fr

Re: [sqlalchemy] Re: Advice on cascading polymorphic inheritance

2019-08-22 Thread Mike Bayer
On Thu, Aug 22, 2019, at 2:06 PM, Javier Martínez wrote: > 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? > yes t

Re: [sqlalchemy] Re: Advice on cascading polymorphic inheritance

2019-08-22 Thread Javier Martínez
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 th

Re: [sqlalchemy] Re: Advice on cascading polymorphic inheritance

2019-08-22 Thread Mike Bayer
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, Au

[sqlalchemy] Re: Advice on cascading polymorphic inheritance

2019-08-22 Thread Javier Martínez
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 t