On Aug 25, 2012, at 4:48 PM, jeetu wrote:

> I have a sqlalchemy table defined like follows
> 
> class Album(DeclarativeBase):
> 
>     # Name of mapped db table
>     __tablename__ = 'material'
>     id = Column(Integer, primary_key=True)
>     name = Column(Unicode(50), nullable=False, unique=True)
>     
>     @synonym_for("_voltage")
>     @memoized_property
>     def total_sales(self):
>         do some calculation here
>         return result
> 
> For some reasons(showing it in sqlajqgrid of tw2) I am using synonym_for. Now 
> when I try to use the sorting/comparisons which inturn calls for same 
> functions of sqlalchemy. it does not work. It gives a long traceback with 
> statements like
> 
>     return getattr(self.comparator, attribute)
>   File 
> "/home/jeetu/LEARN/turbogears/tg22_venv/local/lib/python2.7/site-packages/SQLAlchemy-0.7.8-py2.7-linux-x86_64.egg/sqlalchemy/util/langhelpers.py",
>  line 485, in __get__
>     obj.__dict__[self.__name__] = result = self.fget(obj)
>   File 
> "/home/jeetu/LEARN/turbogears/tg22_venv/local/lib/python2.7/site-packages/SQLAlchemy-0.7.8-py2.7-linux-x86_64.egg/sqlalchemy/orm/attributes.py",
>  line 203, in comparator
>     self._comparator = self._comparator()
>   File 
> "/home/jeetu/LEARN/turbogears/tg22_venv/local/lib/python2.7/site-packages/SQLAlchemy-0.7.8-py2.7-linux-x86_64.egg/sqlalchemy/orm/descriptor_props.py",
>  line 67, in <lambda>
>     lambda: self._comparator_factory(mapper),
>   File 
> "/home/jeetu/LEARN/turbogears/tg22_venv/local/lib/python2.7/site-packages/SQLAlchemy-0.7.8-py2.7-linux-x86_64.egg/sqlalchemy/orm/descriptor_props.py",
>  line 376, in _comparator_factory
>     prop = self._proxied_property
> RuntimeError: maximum recursion depth exceeded while calling a Python object
> 
> As to my understanding it is searching for comparator function but not able 
> to find one. I tried implementing some sort of PropComparator, 
> ColumnComparator etc, but not able to get it rigth. Can somebody help me to 
> get the sorting function implemented.


I'd need a full example that reproduces this (which means, a single .py file I 
can copy locally, and run it. ).   the above snippet doesn't include any 
detail, such as what "_voltage" is, what the comparator looks like, etc.


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

Reply via email to