On Fri, Jun 18, 2021 at 3:45 AM Simon King <si...@simonking.org.uk> wrote:

> On Fri, Jun 18, 2021 at 12:21 AM jca...@gmail.com <jcas...@gmail.com>
> wrote:
> >
> > Hi,
> > Does a means exist to generically call a local datetime func such that
> it renders as SYSDATE in Oracle and GETDATE() in SQL Server?
> >
> > Thanks,
> > jlc
> >
>
> Do you need those functions explicitly? I think both databases support
> the CURRENT_TIMESTAMP function (which you'd access as
> sqlalchemy.func.current_timestamp()).
>
> If you really do want to use different functions based on the
> database, the compiler extension is what you want:
>
> https://docs.sqlalchemy.org/en/14/core/compiler.html#utc-timestamp-function
>
> Hope that helps,
>
> Simon
>

Hi Simon,
I originally was relying on a utc datetime and was surprised to see that was
inconsistent with the rest of the application. As surprising as it, I do
need a
local time and your example is perfect.

Thank you very much!
jlc

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAMogvAeTJ_T6YyFcj2V01wuEC4CXhsHnPN_rgSVsvq%2B80YHadQ%40mail.gmail.com.

Reply via email to