sqlalchemy-utc icon indicating copy to clipboard operation
sqlalchemy-utc copied to clipboard

Please document how to use the `mysql_sql_utcnow` functions

Open allardhoeve opened this issue 6 years ago • 2 comments

The functions in now.py look great! But I have no idea how to use them properly. Can you provide a snippet where you actually use them? Thanks!

allardhoeve avatar Apr 09 '19 09:04 allardhoeve

You can simply substitute existing sqlalchemy.sql.functions.now with sqlalchemy_utc.now.utcnow, e.g.:

from sqlalchemy_utc.now import utcnow

article = Article(title='…', content='…', published_at=utcnow())

dahlia avatar Apr 17 '19 06:04 dahlia

You can also use them as server defaults: sa.Column('timestamp', sa.DateTime(True), server_default=utcnow())

gwax avatar Apr 17 '19 17:04 gwax