On Wed, May 28, 2008 at 11:59 AM, Michael Bayer
<[EMAIL PROTECTED]> wrote:
>
>
> On May 28, 2008, at 12:36 PM, Lukasz Szybalski wrote:
>
>>
>> Hello,
>> I have used the following to query my data:
>> #----start
>> class th(object):
>>    pass
>> mapper(th,th_table)
>>
>> a
>> =
>> session
>> .query
>> (th
>> ).filter
>> (sqlalchemy.and_(th.APPLIED_TEST==1,th.CODING_DATE=='20080325')).all()
>> #end
>>
>> I noticed that there is a query
>> th
>> .query
>> ().filter
>> (sqlalchemy.and_(th.APPLIED_TEST==1,th.CODING_DATE=='20080325')).all()
>>
>> but it gives me a :
>> AttributeError: 'generator' object has no attribute 'all'
>
> something else is going on there.  filter() on Query returns a new
> Query in all cases.   What is "th.query()" ?

Since the session is bound to the mapped classes(in tg and in sa). I
shouldn't have to use  session.query(mymappedclass).somfilter

What I want to do is convert the:
session.query(th).filter(sqlalchemy.and_(th.APPLIED_TEST==1,th.CODING_DATE=='20080325')).all()
to just a query using mapped class.

Asumed that session.query(th).somefilter is same as
th.query().somefilter  would do it, but obviously these two are
different.

So I my question is, are the session.query(th).somefilter vs
th.query().somefilter different or am I missing something here.


Lucas

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to