If set timezone=False, the value should be UTC time ? I inserted a new line to database , it's used server timezone : PRC
在 2018年7月24日星期二 UTC+8上午2:10:16,Mike Bayer写道: > > On Mon, Jul 23, 2018 at 2:01 PM, Yingchen Zhang <cevin....@gmail.com > <javascript:>> wrote: > > data type TIMESTAMP just have one param is timezone and it's use server > > timezone setting. > > > > how to create a `timestamp without time zone` column with postgresql ? > > > > code: > > > > Column('created_at', TIMESTAMP(False), nullable=False, > > server_default=text('now()')) > > passing timezone=False will render as "TIMESTAMP WITHOUT TIME ZONE" on > postgresql: > > >>> from sqlalchemy import TIMESTAMP > >>> from sqlalchemy.dialects import postgresql > >>> print(TIMESTAMP(timezone=False).compile(dialect=postgresql.dialect())) > TIMESTAMP WITHOUT TIME ZONE > > > as will the way you have it w/o the name: > > >>> print(TIMESTAMP(False).compile(dialect=postgresql.dialect())) > TIMESTAMP WITHOUT TIME ZONE > > > > > > > > > > > > > > > -- > > 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+...@googlegroups.com <javascript:>. > > To post to this group, send email to sqlal...@googlegroups.com > <javascript:>. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.