Hi,

I currently have the following mix-in class construction (based on the 
documentation 
http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/mixins.html
)

Base = declarative_base() 

class BaseCountry(object): 
   """ Managed through Kotti """ 

   @declared_attr 
   def __tablename__(cls): 
       return cls.__name__.lower() 

   dpis_id = Column(Integer, primary_key=True) 
   title =  Column(Unicode(80)) 
   regions = relationship("Region", 
                            primaryjoin="Country.dpis_id==Region.country_id") 



class Country(BaseCountry, Base): 
   """ Managed through Kotti """ 

   __tablename__ = 'countries'

This gives me 

  File 
"/data/home/ajung/src/kotti/lib/python2.7/site-packages/sqlalchemy/ext/declarative/api.py",
 
line 55, in __init__ 
   _as_declarative(cls, classname, cls.__dict__) 
 File 
"/data/home/ajung/src/kotti/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py",
 
line 88, in _as_declarative 
   _MapperConfig.setup_mapping(cls, classname, dict_) 
 File 
"/data/home/ajung/src/kotti/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py",
 
line 103, in setup_mapping 
   cfg_cls(cls_, classname, dict_) 
 File 
"/data/home/ajung/src/kotti/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py",
 
line 123, in __init__ 
   self._scan_attributes() 
 File 
"/data/home/ajung/src/kotti/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py",
 
line 216, in _scan_attributes 
   "Mapper properties (i.e. deferred," 
sqlalchemy.exc.InvalidRequestError: Mapper properties (i.e. 
deferred,column_property(), relationship(), etc.) must be declared as 
@declared_attr callables on declarative mixin
classes.

Where is the difference to the documentation?

Python 2.7, Sqlalchemy 1.0.11

Andreas

-- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to