Re: [sqlalchemy] server_default=text('1970-01-01 00:00:01') changed when run in a different timezone

2019-10-09 Thread Mike Bayer
you probabbly should report this over at 
https://github.com/agronholm/sqlacodegen 



On Wed, Oct 9, 2019, at 1:32 PM, Thomas Ryan wrote:
> I have the following fields defined in a table.
> 
>  `updated` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
>  `deleted` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
> 
> When someone runs SQLACODEGEN it changes the definition of the server_default 
> time based on the timezone the developer is in when they run it. Someone in 
> the eastern timezone gets 
> 
>  updated = Column(TIMESTAMP, nullable=False, index=True, 
> server_default=text("'1970-01-01 00:00:01'"))
>  deleted = Column(TIMESTAMP, nullable=False, index=True, 
> server_default=text("'1970-01-01 00:00:01'"))
> 
> However, someone in the central timezone gets 
> 
>  updated = Column(TIMESTAMP, nullable=False, index=True, 
> server_default=text("'1969-12-31 23:00:01'"))
>  deleted = Column(TIMESTAMP, nullable=False, index=True, 
> server_default=text("'1969-12-31 23:00:01'"))
> 
> Is there a parameter that can be provided to not change the model.py and use 
> the 1970 date?
> 

> --
>  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/0b86a03a-016a-40bb-8a0e-91b4ee62ce3a%40googlegroups.com
>  
> .

-- 
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/59ae659f-5c65-4adc-8775-b1c225840acc%40www.fastmail.com.


[sqlalchemy] server_default=text('1970-01-01 00:00:01') changed when run in a different timezone

2019-10-09 Thread Thomas Ryan
I have the following fields defined in a table.

  `updated` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `deleted` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',

When someone runs SQLACODEGEN it changes the definition of the 
server_default time based on the timezone the developer is in when they run 
it.  Someone in the eastern timezone gets 

updated = Column(TIMESTAMP, nullable=False, index=True, 
server_default=text("'1970-01-01 00:00:01'"))
deleted = Column(TIMESTAMP, nullable=False, index=True, 
server_default=text("'1970-01-01 00:00:01'"))

However, someone in the central timezone gets 

updated = Column(TIMESTAMP, nullable=False, index=True, 
server_default=text("'1969-12-31 23:00:01'"))
deleted = Column(TIMESTAMP, nullable=False, index=True, 
server_default=text("'1969-12-31 23:00:01'"))

Is there a parameter that can be provided to not change the model.py and 
use the 1970 date?

-- 
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/0b86a03a-016a-40bb-8a0e-91b4ee62ce3a%40googlegroups.com.