!!! note This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process here

Here's my thought on 💭 Column INSERT/UPDATE Defaults — SQLAlchemy 1.4 Documentation


sqlalchemy server_defaults end up as defaults in the database when new values are inserted.


t = Table(
    "test",
    metadata_obj,
    Column("abc", String(20), server_default="abc"),
    Column("created_at", DateTime, server_default=func.sysdate()),
    Column("index_value", Integer, server_default=text("0")),
)

CREATE TABLE test (
    abc varchar(20) default 'abc',
    created_at datetime default sysdate,
    index_value integer default 0
)

This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts