[web2py] Re: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-24 Thread Val K
running example: # fake table in which result of recursive select will be temporary stored # id-values will be inherited from parent_child table db.define_table('entry_collector', Field('child', 'integer'), Field('xpath', 'json'), # array of ids, xpath[0] == root, xpath[-1] ==

[web2py] Left join with filters on joined table

2018-11-24 Thread David Orme
Hi, I've got a table 'sites' and a table 'audio', where sites.id = audio.site_id. I'm trying to create a service that returns a list of sites with the number of audio recordings at each site, including zero counts. That's easily achieved using: sitedata = db(db.sites).select(db.sites.ALL,

[web2py] Re: Left join with filters on joined table

2018-11-24 Thread Val K
try remove db.sites from query (just db().select(...)) db(db.sites) is shortcut for db(db.sites.id>0) which turns into WHERE (( sites.id IS NOT NULL) On Sunday, November 25, 2018 at 1:00:56 AM UTC+3, David Orme wrote: > > Hi, > > I've got a table 'sites' and a table 'audio', where sites.id =

Re: [web2py] Re: Left join with filters on joined table

2018-11-24 Thread David Orme
Thanks for the suggestion. I've actually tried that and get exactly the same results - I read somewhere that using an empty db() could be problematic, so tried both. It doesn't affect the result without any audio queries, but any audio queries added into the selected set (qry in my code), cause th

Re: [web2py] Help needed with web2py-book app

2018-11-24 Thread Nico Zanferrari
Hi, I'm proud to announce that I've finished the work, and now the web2py book is python3 compatible, as with PR #395 It was a hard work for me, but I've learned a lot ;-) Cheers, Nico Il giorno lun 15 ott 2018 alle ore 22:26 Nico Zanferrari ha s

Re: [web2py] Re: Left join with filters on joined table

2018-11-24 Thread Val K
Try to move db.audio.start_time > '12:00:00' in the left join ON: left=db.audio.on((db.audio.site_id == db.sites.id) & (db.audio.start_time > '12:00:00')) On Sunday, November 25, 2018 at 1:34:54 AM UTC+3, David Orme wrote: > > Thanks for the suggestion. I've actually tried that and get exactly

[web2py] Re: Restricting values entered into a field to a certain minimum

2018-11-24 Thread mostwanted
I ended up creating my custom validator, to handle this situation. On Friday, November 23, 2018 at 2:55:03 PM UTC+2, mostwanted wrote: > > How can I restrict a value entered into a database field to a certain > desirable minimum? > > -- Resources: - http://web2py.com - http://web2py.com/book (D