perhaps we'd want to establish "mapper.with_polymorphic" as a setter that will 
perform the requisite validations on it whenever it is set.    I think you can 
set it right now on the mapper at any point, it doesn't seem to be consulted in 
any configurational way.   The only "validations" that occur are on the second 
argument if it is not None.

Give that a try first.   

There is a hackish recipe we have at 
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DeclarativeAbstractConcreteBase
 which illustrates how to set up a mapper with declarative where the mapper() 
is created later, but it would be nice if we could provide the "callable" 
approach of relationship() for things like this at some point in the future.

Also I don't like with_polymorphic very much but I don't have a better idea at 
the moment.


On Jul 20, 2011, at 8:36 AM, Torsten Landschoff wrote:

> Hi *,
> 
> is there a way to use the with_polymorphic mapper option for classes yet
> to be defined?
> 
> My problem is that I have a base class for a number of different
> database objects. There are few specific leafs classes of which many
> instances are loaded at once.
> 
> Currently, I pass "with_polymorphic=("*", None) while mapping, but that
> creates huge query for little effect. I would like to pass the two
> classes I am interested in but they are defined in other modules (which
> depends on the module where I map the base class).
> 
> Is there a way to update the with_polymorphic setting on the base class
> when mapping the derived class?
> 
> Greetings, Torsten
> 
> -- 
> DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
> Torsten Landschoff
> 
> Office Dresden
> Tel: +49-(0)351-4519587
> Fax: +49-(0)351-4519561
> 
> mailto:torsten.landsch...@dynamore.de
> http://www.dynamore.de
> 
> Registration court: Mannheim, HRB: 109659, based in Karlsruhe,
> Managing director:  Prof. Dr. K. Schweizerhof, Dipl.-Math. U. Franz
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to