Actually to be specific I am getting following error now

Errorlog
*****************************************************************************************
File '/home/mihir/development/web/web/controllers/real.py', line 187 in
search
  total_matches = matching_products.count()
File
'/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/query.py',
line 1552 in count
  should_nest = should_nest[0]
File
'/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/query.py',
line 1583 in _col_aggregate
  return self.session.scalar(s, params=self._params,
mapper=self._mapper_zero())
File
'/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/session.py',
line 758 in scalar
  return self.execute(clause, params=params, mapper=mapper, **kw).scalar()
File
'/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/session.py',
line 750 in execute
  engine = self.get_bind(mapper, clause=clause, **kw)
File
'/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/session.py',
line 888 in get_bind
  ', '.join(context)))
UnboundExecutionError: Could not locate a bind configured on mapper
Mapper|Product|products, SQL expression or this Session

*******************************************************************************************************

On Fri, Apr 29, 2011 at 8:32 PM, Mihir Sevak <mihir.se...@gmail.com> wrote:

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



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

Reply via email to