On Mar 17, 2014, at 6:48 AM, Pau Tallada <tall...@pic.es> 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 are loaded, so not all the subclasses > are present/defined in the Metadata, but I still need to query those > instances and access their columns. > > Is there any option/feature/trick to temporarily disable polymorphism in a > single query (or globally for a session or engine) and load all classes as > instances of the base class?
you can use a non primary mapper: m = mapper(MyBase, my_base_table, non_primary=True) s.query(m).all() > > The other option is to hack some kind of on-demand polymorphism myself into > the __new__ method of the Base class. > > Thanks! > > Pau. > > -- > ---------------------------------- > Pau Tallada Crespí > Dep. d'Astrofísica i Cosmologia > Port d'Informació Científica (PIC) > Tel: +34 93 586 8233 > ---------------------------------- > > > -- > 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. -- 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.