is it possible to do something like SELECT column1, column2 is null FROM table.. in DAL?

Skip to first unread message

Dragan Matic

Jun 21, 2023, 1:47:34 PM6/21/23
to web2py-users
Postgresql allows this syntax:

SELECT column1, column2 is null FROM table WHERE...

Which returns the value from column one and a true/false for column2 like this:

column1      column2
value1          true
value2          false

To summarize, I just want for database to tell me whether column2 is null or not, I do not want to read the whole column2 and check it in program as it may contain a lot of text and will slow down execution. Can I translate this select to DAL?


Jun 21, 2023, 7:09:30 PM6/21/23
PyDal doen't implements is_null, but you can try something like that

t = db.yourtable
exp = "column2 is null"
print(db(t).select(t.column1, exp))

- (Documentation)
- (Source code)
- (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
To view this discussion on the web visit

Reply all
Reply to author
0 new messages