Using SQLAlchemy, alembic and postgres, when I try to set the column at the time the row was created, what I finally got is a field that by default refers to the time the table was created, and not the time the row was created.
Model Code:
datetime = sa.Column(sa.DateTime, nullable=False, server_default=func.now())
Alembic translates it into:
sa.Column('datetime', sa.DateTime(), server_default='now()', nullable=False),
And the column in Postgres:
datetime | timestamp without time zone | not null default '2013-06-24 11:28:14.930524'::timestamp without time zone
What should I do so that by default there is a line creation time?
source share