pyDAL - Spurious "cross join"

46 views
Skip to first unread message

villas

unread,
Aug 4, 2017, 12:25:14 PM8/4/17
to web...@googlegroups.com
According to the book,  I should be able to append 'join' statements to a list.  Here is what happens:

>>> joinlist = []
>>> joinlist.append( db.res.on(db.extra_dates.res_id == db.res.id) )
>>> joinlist.append( db.prop.on(db.res.prop_id == db.prop.id) )

>>> db()._select(db.prop.id, join=joinlist )

'SELECT prop.id FROM extra_dates CROSS JOIN prop JOIN res ON (extra_dates.res_id = res.id) JOIN prop ON (res.prop_id = prop.id) ORDER BY prop.id;'


This SQL is wrong and creates a ticket because an unwanted 'CROSS JOIN' has been added.  In my case I am using Firebird,  but I believe this is irrelevant because it happens in base.py which probably affects all DBs. 

I'm posting this initially here because the same problem was posted a couple of years ago. 

Maybe there's a workaround, or I'm missing something? 




villas

unread,
Aug 4, 2017, 12:57:56 PM8/4/17
to web2py-users
With a where clause,  it works OK.
However,  in my example,  I still should not have generated a CROSS JOIN. 
I guess it's just a pyDAL issue.

Richard Vézina

unread,
Feb 28, 2018, 10:03:15 AM2/28/18
to web2py-users

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages