[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-27 Thread Niphlod
you're right. the "query" actually is only the "where" part, and if you serialize that as a string it loses other attributes necessary to construct the other parts of the query. Now, I don't understand why this is a problem: you can: - cache the results without hitting the database twice using t

[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-26 Thread Limedrop
Hi Niphlod, Thanks for your reply. I'm running 1.99.7 and here's the model: db.define_table('webpage', Field('title'), Field('body', 'text')) db.define_table('comment', Field('page_id', db.webpage), Field('body', 'text')) The issue is when you have an implicit inner join, but w

[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-26 Thread Niphlod
damn mobile phone screen I got it, seems a simple join, and for my simple model works without a hitch. can you please post your model and tell what web2py version are you running ? Il giorno lunedì 26 marzo 2012 01:58:31 UTC+2, Limedrop ha scritto: > > The difference is in the FROM clause.

[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-25 Thread Limedrop
The difference is in the FROM clause. In the second SQL the webpage table is missing. On Mar 26, 12:51 pm, Niphlod wrote: > is that because of the "extra" () ? > every time you call db() the where clause gets "encapsulated" in a pair of > parenthesis. > > db(db.auth_user.id>0)(db.auth_user.email

[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-25 Thread Niphlod
is that because of the "extra" () ? every time you call db() the where clause gets "encapsulated" in a pair of parenthesis. db(db.auth_user.id>0)(db.auth_user.email==localhost) and db((db.auth_user.id>0) & (db.auth_user.email==localhost)) give you different raw strings, but the same exact resu