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_colidentifying 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:
TEXT→str,INTEGER→int,REAL→int/float,BLOB→bytes.boolis rejected forINTEGER/REALcolumns.
Returns
None
Raises
- ValueError
- If
col_namedoes not exist in the table. - TypeError
- If the type of
valuedoes not match the column's declared type.