I was trying to add an AttributeExtension to a property from my
MapperExtension but I get this error when trying to access the
property:
AttributeError: 'Mapper' object has no attribute '_props'
Here's a test case:
from sqlalchemy import create_engine, Column
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import Integer, String
from sqlalchemy.orm import scoped_session, sessionmaker, deferred
from sqlalchemy.orm.interfaces import MapperExtension
engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_base(bind=engine)
class MyExtension(MapperExtension):
def __init__(self, property):
self.property = property
def instrument_class(self, mapper, class_):
property = mapper.get_property(self.property)
print property
class Item(Base):
__tablename__ = 'items'
__mapper_args__ = {'extension': MyExtension('name')}
id = Column(Integer, primary_key=True)
name = deferred(Column(String))
--
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.