Hi Mike thanks very much for taking time to respond to my question. After taking the alias away it stopped complaining about that perticular line. But the function which was calling this function did not get query results. So tried to print "q" itself and it was the query-line itself instead of results.
Something like "SELECT xXXX DESC" Is there some change in the way to read the results from "q" object? Because I have not changed a single letter of the code and what work on other platform doesn't work here. So i am confused. Thanks for your help. On Fri, Apr 29, 2011 at 8:13 PM, Michael Bayer <mike...@zzzcomputing.com>wrote: > > On Apr 29, 2011, at 1:55 PM, Mihir wrote: > > > @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 > > > > AttributeError: Element to_tsquery(:to_tsquery_1) does not support > > 'as_scalar()' > > you probably don't want to call "alias('query')" on the func.to_tsquery() > object. that turns it into an aliased SELECT construct that isn't > particularly appropriate to pass to an operator ('@@' above). > > -- > 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. > > -- "How can anything be impossible when impossible itself says I M Possible???" Mihir -- 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.