Skip to content

set_cell

set_cell(index_col, index_value, col_name, value)

Sets the value of a single cell, located by row and column, then commits. The row is identified by the value of its index column (typically the primary key), the column by name. The Python type of value is validated against the column's declared SQLite type before writing.

Parameters

index_col : str
Name of the index/primary-key column used to locate the row.
index_value : str or float or int
Value of index_col identifying the target row.
col_name : str
Name of the column whose cell is being set.
value : str or float or int or bytes
New value for the cell. Its type must match the declared column type: TEXTstr, INTEGERint, REALint/float, BLOBbytes. bool is rejected for INTEGER/REAL columns.

Returns

None

Raises

ValueError
If col_name does not exist in the table.
TypeError
If the type of value does not match the column's declared type.