You've already forked Travel-Agent
16 lines
385 B
Python
16 lines
385 B
Python
__all__ = ("utcnow",)
|
|
|
|
from sqlalchemy.ext.compiler import compiles
|
|
from sqlalchemy.sql import expression
|
|
from sqlalchemy.types import DateTime
|
|
|
|
|
|
class utcnow(expression.FunctionElement): # noqa: N801
|
|
type = DateTime() # noqa: A003
|
|
inherit_cache = True
|
|
|
|
|
|
@compiles(utcnow, "postgresql")
|
|
def pg_utcnow(element, compiler, **kw):
|
|
return "TIMEZONE('utc', CURRENT_TIMESTAMP)"
|