Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-25 Thread Pau Tallada
Hi! I've finally made some progress :) The following code works for the most of my needs: Dependency and JobModel define the columns in the DB. AbstractJob is the common ancestor in the hierarchy. It also defines the common API. Job is the polymorphic version, and HelloJob and ByeJob are subclass

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-24 Thread Pau Tallada
No, polymorphic_on=None does not have any effect :( I'll keep trying :P Thanks! Pau. 2014-03-17 18:56 GMT+01:00 Michael Bayer : > er, guessing, polymorphic_on=None also for that class? not sure of the > mapper’s tolerance. > > > On Mar 17, 2014, at 12:10 PM, Pau Tallada wrote: > > Hi, I trie

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Michael Bayer
er, guessing, polymorphic_on=None also for that class? not sure of the mapper's tolerance. On Mar 17, 2014, at 12:10 PM, Pau Tallada wrote: > Hi, I tried this, but then it selects "WHERE .type IN (NULL)" :( > > class NonPolymorphicClass(MyBaseClass): > __mapper_args__ = { > 'concr

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Pau Tallada
Hi, I tried this, but then it selects "WHERE .type IN (NULL)" :( class NonPolymorphicClass(MyBaseClass): __mapper_args__ = { 'concrete' : True } I'll try some more things, like overriding the __new__ method on the base class, to create subclasses if they are available, and instances o

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Michael Bayer
maybe make a subclass of the polymorphic base, and just put __concrete__ = True in the mapper_args.skip the non primary part. On Mar 17, 2014, at 8:45 AM, Pau Tallada wrote: > Hi, > > Can it be done in declarative? > I've tried several ways, but I cannot find a working one :/ > Basicall

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Pau Tallada
Hi, Can it be done in declarative? I've tried several ways, but I cannot find a working one :/ Basically, I think I need to redefine some self-referential relationships, as they link against the polymorphic class. Meta = declarative_meta() class NonPolymorphicClass(MyBaseClass): __mapper_ar

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Pau Tallada
Great! I think it works for my needs :D Thank you very much! Pau. 2014-03-17 12:28 GMT+01:00 Michael Bayer : > > On Mar 17, 2014, at 6:48 AM, Pau Tallada wrote: > > Hi everyone :) > > I have an application with some kind of dynamic model. > Several plugins define subclasses of a common base

Re: [sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Michael Bayer
On Mar 17, 2014, at 6:48 AM, Pau Tallada wrote: > Hi everyone :) > > I have an application with some kind of dynamic model. > Several plugins define subclasses of a common base class and override their > behaviour, but they do not change any column. > > In some scenarios, not all the puglins

[sqlalchemy] single table hierarchy: disable polymorphism and load all as base class

2014-03-17 Thread Pau Tallada
Hi everyone :) I have an application with some kind of dynamic model. Several plugins define subclasses of a common base class and override their behaviour, but they do not change any column. In some scenarios, not all the puglins are loaded, so not all the subclasses are present/defined in the M