Re: [web2py] is_in_db with union select

2013-08-01 Thread Niphlod
the important part is that you cache it somewhere, either using select(..cache) or storing the actual set to pass to the is_in_set validator. On Thursday, August 1, 2013 2:56:40 PM UTC+2, Antonis Konstantinos Tzorvas wrote: > > i don't know much about cache yet, > if i am not mistaken it caches

Re: [web2py] is_in_db with union select

2013-08-01 Thread Antonis Konstantinos Tzorvas
i don't know much about cache yet, if i am not mistaken it caches the two queries separated my query is this: years = [i.year for i in union(db(db.table1.station_id==this_station.id).select(db.table1.year),db(db.table2.station_id==this_station.id).select(db.table2.year)).sort(lambda row: row.ye

Re: [web2py] is_in_db with union select

2013-08-01 Thread Niphlod
I sincerely hope that this gets cached somewhere in your app, because if instead they are in models, you're doing 2 selects for every request On Thursday, August 1, 2013 2:21:07 PM UTC+2, Antonis Konstantinos Tzorvas wrote: > > yes you are right, i was looking also in IS_IN_SET > and finally af

Re: [web2py] is_in_db with union select

2013-08-01 Thread Antonis Konstantinos Tzorvas
yes you are right, i was looking also in IS_IN_SET and finally after your reminder one solution came up easily, IS_IN_SET([i.name for i in rows = union(db().select(db.a.name),db().select( db.b.name)).sort(lambda row: row.name)]) which now displays all the values of a required column from both tab

Re: [web2py] is_in_db with union select

2013-08-01 Thread Vinicius Assef
I don't think so. The book says IS_IN_DB() can receive a Set, but not Rows. On Thu, Aug 1, 2013 at 8:33 AM, Antonis Konstantinos Tzorvas wrote: >> --- https://groups.google.com/d/msg/web2py/o3GebSeC7j4/Sct76ynB3fsJ >> >> db=DAL()db.define_table('a',Field('name')) >> db.define_table('b',Fiel

[web2py] is_in_db with union select

2013-08-01 Thread Antonis Konstantinos Tzorvas
> > --- https://groups.google.com/d/msg/web2py/o3GebSeC7j4/Sct76ynB3fsJ > db=DAL()db.define_table('a',Field('name')) > db.define_table('b',Field('name')) > db.a.insert(name='Alex') > db.a.insert(name='Max') > db.a.insert(name='Tim') > db.b.insert(name='John') > db.b.insert(name='Jack') > def