Hi,

I'm hitting some issues with single table inheritance and the reflected declarative example interacting badly...

I'm not sure I have my head around this 100% and certainly no idea what to do about it, so thought I'd see what others (Mike ;-) ) think...

IIUC, the following breaks:

class GeneralType(Reflected):
    __tablename__ = 'the_table'
    __mapper_args__ = dict(polymorphic_on='col')

class TypeOne(GeneralType):
    __mapper_args__ = dict(polymorphic_identity='one')

...firstly because we don't have a column object to pass to polymorphic_on (shame that and primary_key don't take a string(s)), but in my interpretation of the recipe I've worked around that.

However, the one that's stumped me is an InvalidRequestError saying 'the_table' is already defined for this MetaData instance.

I believe that this because there's some dancing around using _is_mapped_class that gets confused when declarative reflection is used, because the actual mapping is deferred until later.

Any suggestions on this front?

My thinking was leaning towards actually abandoning the full declarative base and coming up with a light weight one (or maybe even class decorator) that basically added recorded the class in a sequence (much like the declarative reflection does) and then calls instrument_declarative with each class at the point of relfection.

Does that sound sane?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

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

Reply via email to