[Chicago] GAE queries

Massimo Di Pierro mdipierro at cs.depaul.edu
Fri Jun 27 20:27:27 CEST 2008


This is a typical one

def accessible(table_name,access_types=('read',)):
     return db(db.access.users_group.belongs(g_tuple))\
              (db.access.table_name==table_name)\
              (db.access.access_type.belongs(access_types))\
               
(db[table_name].id==db.access.record_id).select(db[table_name].ALL))

Massimo


On Jun 27, 2008, at 11:52 AM, Carl Karsten wrote:

> Massimo Di Pierro wrote:
>> Most of the GAE functionality is supported by the web2py ORM and  
>> *any*
>> program written with web2py for GAE works on other databases
>> (mysql,postgresql,sqlite, oracle (and mssq soon)). The opposite is  
>> not
>> true. For example
>>
>>     
>> db 
>> (db.table.field='value').select(db.table.ALL,orderby=~db.tabel.field)
>>
>> works everywhere including GAE but
>>
>>
>> db 
>> ((db 
>> .table 
>> .field 
>> = 
>> 'value 
>> ')&(db 
>> .othertable 
>> .id 
>> = 
>> = 
>> db 
>> .table.referencefield)).select(db.table.ALL,orderby=~db.tabel.field)
>>
>>
>> does not work on GAE because it does a join.
>
> Somewhere I have some code to do 'client side join' when the base  
> tables were on
> different data sources (servers).  worst case I dig it up and we  
> figure out how
> to use it as designed.  my hunch is GAE provides something better.
>
> post some code from kpax - maybe we can figure out how to make it run.
>
> Carl K
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago



More information about the Chicago mailing list