[sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent
Along the same lines, is there something we can do about nvl() (oracle) versus coalesce() (ansi)? They aren't exactly the same, unfortunately (nvl takes exactly 2 arguments, no more), so maybe there is nothing 'official' you can do, but can you help me work it out for my project? I assume it is

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Michael Bayer
Kent wrote: Along the same lines, is there something we can do about nvl() (oracle) versus coalesce() (ansi)? They aren't exactly the same, unfortunately (nvl takes exactly 2 arguments, no more), so maybe there is nothing 'official' you can do, but can you help me work it out for my project?

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent Bower
Thanks very much. On 4/2/2010 5:41 PM, Michael Bayer wrote: Kent wrote: Along the same lines, is there something we can do about nvl() (oracle) versus coalesce() (ansi)? They aren't exactly the same, unfortunately (nvl takes exactly 2 arguments, no more), so maybe there is nothing

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent Bower
As an aside, more recent Oracles support ansi coalesce, so it is probably more appropriate to only use nvl() for older, non-ansi Oracle versions, but if this is only for illustration then that is not a big deal (unless you don't want people writing to you saying coalesce does support more than

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Michael Bayer
Kent Bower wrote: As an aside, more recent Oracles support ansi coalesce, so it is probably more appropriate to only use nvl() for older, non-ansi Oracle versions, but if this is only for illustration then that is not a big deal (unless you don't want people writing to you saying coalesce

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Ian Kelly
On Fri, Apr 2, 2010 at 3:41 PM, Michael Bayer mike...@zzzcomputing.comwrote: Kent wrote: Along the same lines, is there something we can do about nvl() (oracle) versus coalesce() (ansi)? They aren't exactly the same, unfortunately (nvl takes exactly 2 arguments, no more), so maybe

[sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent
Just to be inconsistent, with one argument, databases handle this differently: postgres: # select coalesce(0); coalesce -- 0 (1 row) Oracle 10g: select coalesce(0) from dual * ERROR at line 1: ORA-00938: not enough arguments for function On Apr 2, 7:08 pm, Ian Kelly

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent Bower
By the way, Unless a ClauseList is subscriptable in 0.6, I had problems the way it was. Here is what I did: @compiles(coalesce, 'oracle') def compile(element, compiler, **kw): sql = nvl(%s) clauses = map(compiler.process, element.clauses) for i in xrange(len(clauses) - 2):

[sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent
Any chance you plan to make func.now consider oracle and use_ansi=False (and return sysdate)? On Feb 3, 4:44 pm, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: Any chance SQLAlchemy has a mechanism to switch to or fromsysdatevs. current_datebased on the database dialect (and

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Michael Bayer
Kent wrote: Any chance you plan to make func.now consider oracle and use_ansi=False (and return sysdate)? the use_ansi flag should be removed as far as public API since we can detect server version now. we can also make now() return sysdate() unconditionally on oracle, you should give us a

[sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-02-03 Thread Kent
Many thanks. On Feb 3, 3:44 pm, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: Any chance SQLAlchemy has a mechanism to switch to or from sysdate vs. current_date based on the database dialect (and maybe use_ansi)? It would be really nice if I could program in sqla not