Hi Massimo

I am not familiar with the method you suggested but when I tried it, I got 
the following error:

print db(Expression(db,"business_view.loc && 
ST_MakeEnvelope(42.179139323652443, 141.20906066894531, 42.307520083522473, 
143.34776306152344)")).select().as_list()
NameError: global name 'Expression' is not defined


In any case, in the non-working example that I tried, I was trying to use the 
bounding box operator in postgis, which is not currently available in the 
DAL... With the approach I suggested, I managed to get it to work without 
issues.



On Wednesday, 26 June 2013 15:09:25 UTC+8, Massimo Di Pierro wrote:
>
> Can you show an example of how you plan to use something like this. I 
> believe there is already a method 
>
> db(Expression(db," ... raw query ...")).select()
>
> perhaps I do not understand.
>
> On Tuesday, 25 June 2013 22:36:45 UTC-5, Calvin wrote:
>>
>> I think it would be nice to specify custom operators that can be used 
>> with the DAL as I believe this would allow for operators that are currently 
>> yet to be supported with a built-in DAL operator...
>>
>> From dal.py, I am thinking this should be relatively easy to implement, 
>> and code would be along the lines of:
>>
>> update to dal.py
>>
>> def raw_where(self, value, op):
>>   db = self.db
>>   return Query(db, op, self, value)
>>
>>
>> which enables the following in a project
>>
>> def OPERATOR(self, first, second):
>>   return '(%s && %s)' % (self.expand(first), self.expand(second)) //'this 
>> return expression should be customised...
>>
>>
>> rows = db(db.table.field.raw_where(parameter, OPERATOR)).select()
>>
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to