Now if I only run

db(db.my_table.logged_user == 1)._select()

I get:

'SELECT  my_table.id, my_table.my_column, my_table.logged_user FROM 
my_table WHERE ((my_table.logged_user = 1) AND (my_table.logged_user IS 
NULL));'

Why is the query is trying to validate that the logged_user is null? thanks!


El lunes, 3 de octubre de 2016, 12:20:21 (UTC-5), Bernardo Leon escribió:
>
> Thanks for noting it, now I am passing the user id as part of pvars of the 
> task but with not much progress, though
>
> If I run that query I get an empty list: []
>
> El lunes, 3 de octubre de 2016, 12:01:22 (UTC-5), Anthony escribió:
>>
>> Note, auth.user_id will be None in the shell.
>>
>> What happens if you do (note the ._select rather than .select):
>>
>> db.executesql(db(db.my_table.logged_user == 1)._select())
>>
>> Anthony
>>
>> On Monday, October 3, 2016 at 12:40:09 PM UTC-4, Bernardo Leon wrote:
>>>
>>> I load my application in this way:
>>> $ python web2py.py -M -S myexistingapp
>>>
>>>
>>> if I run:
>>>
>>> db(db.my_table.logged_user == auth.user_id).select()
>>>
>>> I get: <Rows (0)>
>>>
>>> even if I run:
>>>
>>> db(db.my_table.logged_user == 1).select()
>>>
>>> or 
>>>
>>> db(db.my_table.logged_user == 1L).select()
>>>
>>> I get: <Rows (0)>
>>>
>>> but if I run:
>>>
>>> db.executesql('select * from my_table where logged_user = 1;')
>>>
>>> I get my list of rows.
>>>
>>> Why is this happening? I found this issue because I was getting <Rows 
>>> (0)> on my scheduler.py task.
>>>
>>> Thanks in advance for any help I get with this issue.
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to