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