No.
On Jan 3, 9:27 am, pallav wrote:
> Hi Massimo,
>
> Using raw SQL would defeat the purpose of using the DAL. Are there any
> plans to enhance the DAL to include constructs for CASE statements?
>
> Thanks
> Pallav
>
> On Dec 30 2010, 12:11 pm, mdipierro wrote:
>
> > this works for me and this
Hi Massimo,
Using raw SQL would defeat the purpose of using the DAL. Are there any
plans to enhance the DAL to include constructs for CASE statements?
Thanks
Pallav
On Dec 30 2010, 12:11 pm, mdipierro wrote:
> this works for me and this time I tried:
>
> >>> db.define_table('a',Field('b'))
> >>
Thank you that works !
I am posting this list of samples that I created to help me get
familiar with the DAL. Hope this helps someone out.
If anyone has any suggested improvements on the syntax please feel
free to repost this with the improvements.
#===
this works for me and this time I tried:
>>> db.define_table('a',Field('b'))
>>> query=db.a
>>> print db(query)._select("CASE WHEN 1=1 THEN 0 ELSE 1 END");
SELECT CASE WHEN 1=1 THEN 0 ELSE 1 END FROM a WHERE (a.id > 0);
>>> rows = db(query).select("CASE WHEN 1=1 THEN 0 ELSE 1 END");
On Dec 30,
I already tried the None approach and it didn't work. It returns
"TypeError: 'NoneType' object is not callable"
Doing the executesql just defeats the purpose of the DAL. We want to
code to be database independent.
I am in no hurry so if you can post a working sample of this whenever
you have time
It is definitively possible. It just that I cannot test it right now.
Try:
db(query).select(Expression("CASE WHEN 1=1 THEN 0 ELSE 1 END",None));
else you can use
db.executesql("... any raw sql ...")
the latter is the safe way. Always works.
On Dec 29, 6:55 pm, Harkirat wrote:
> Thanks for the
Thanks for the suggestion Massimo! I haven't been able to get it to
work though.
That syntax returns an error "TypeError: __init__() takes at least 3
arguments (2 given)"
Tried looking at the Expression class defined in DAL.py for what
arguments it needs but haven't been able to figure this out.
An
Cool
On Dec 29, 8:56 am, mdipierro wrote:
> You should be able to doL
>
> from gluon.dal import Expression
>
> db(query).select(Expression("CASE WHEN 1=1 THEN 0 ELSE 1 END"));
>
> Nut I never tried.
>
> On Dec 29, 8:37 am, Harkirat wrote:
>
>
>
> > Hi All !
> > I am new to web2py and m
You should be able to doL
from gluon.dal import Expression
db(query).select(Expression("CASE WHEN 1=1 THEN 0 ELSE 1 END"));
Nut I never tried.
On Dec 29, 8:37 am, Harkirat wrote:
> Hi All !
> I am new to web2py and my company is building an enterprise
> level web application that wil
I'm not aware of anything like this, but of course you can execute SQL
directly with web2py
10 matches
Mail list logo