Hello All,
        I am more of a C and C++ developer with basic knowledge of
Databases.
I am tasked with a project which is written in Python specifically in
Pylons and
uses Postgresql database engine. Following is a piece of code which
was working
with older version of Debian machine but now when upgraded machines it
stopped
working. I am listing the error log as well. Can you please give me
some hints on
what should be done to fix this problem?

I really appreciate your help.
Thanks in advance.

Code
================================================================
  @classmethod
    def fulltext_adv(cls, search_string, raw_search=''):
        q = Session.query(cls)
        text_query = func.to_tsquery(search_string).alias('query')
        q = q.filter(cls.tsv.op('@@')(text_query))
        if raw_search:
            q = q.order_by(Product.name.op('ilike')(raw_search +
'%').desc())
        q = q.order_by(sa.desc(func.ts_rank_cd(cls.tsv,
sa.literal_column('query'), 1)))
        return q

=================================================================

Errorlog
******************************************************************************************************
File '/home/mihir/development/pylons/myweb/myweb/controllers/real.py',
line 185 in search
  matching_products = Product.fulltext(search_string)
File '/home/mihir/development/pylons/web/web/model/model.py', line
1094 in fulltext
  return cls.fulltext_adv(fixed_search, raw_search=search_string)
File '/home/mihir/development/pylons/itrackrweb/itrackrweb/model/
model.py', line 1082 in fulltext_adv
  q = q.filter(cls.tsv.op('@@')(text_query))
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/expression.py', line 1535 in op
  return self.operate(operators.op, opstring, b)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/orm/attributes.py', line 127 in operate
  return op(self.comparator, *other, **kwargs)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/operators.py', line 42 in op
  return a.op(opstring)(b)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/expression.py', line 1535 in op
  return self.operate(operators.op, opstring, b)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/orm/properties.py', line 158 in operate
  return op(self.__clause_element__(), *other, **kwargs)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/operators.py', line 42 in op
  return a.op(opstring)(b)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/expression.py', line 1893 in <lambda>
  return lambda other: self.__operate(operator, other)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/expression.py', line 1679 in __operate
  obj = self._check_literal(op, obj)
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/expression.py', line 1913 in _check_literal
  return other.as_scalar()
File '/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.7-
py2.6.egg/sqlalchemy/sql/expression.py', line 3315 in as_scalar
  "'as_scalar()'" % self.element)
AttributeError: Element to_tsquery(:to_tsquery_1) does not support
'as_scalar()'

-- 
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