Skip to content

add_column

add_column(col_name, col_type="TEXT", default=None)

Adds a new column to the table via ALTER TABLE ... ADD COLUMN and commits. Existing rows receive default (or NULL when default is not given).

Parameters

col_name : str
Name of the column to add.
col_type : str, optional
SQLite column type/affinity ("TEXT", "INTEGER", "REAL", "BLOB"). Defaults to "TEXT".
default : str or float or int or None, optional
Default value applied to existing rows and used when no value is supplied on insert. When None (default), no DEFAULT clause is emitted and existing rows receive NULL.

Returns

None