I've encounter an error today when I've try to inherit from a mixin who 
implements the __declare_last__ method on a mapper that defines also the 
__declare_last__ method.

Here's what my code looks like:

class Mixin(object):

    @classmethod
    def __declare_last__(cls):
        cls.do_something()


class TableA(DeclarativeBase, Mixin):

    @classmethod
    def __declare_last__(cls):
        cls.relationB = sqlalchemy.orm.relation(TableB)
        

When the code is executed I've the error : AttributeError: 
'RelationshipProperty' object has no attribute 'my_column_name' that is 
raised when I try to execute a query using the relationB
Even if I do nothing in the __declare_last__ from the mixin I've the same 
error, when I've removed the __declare_last__ the code works perfectly.

I want to be able to have a default behavior on the __declare_last__ that 
can be overridded on my mappers, but actually both methods triggers the 
after_configured event.

Did you have any clue to avoid that error ?

Thanks
Martin

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to