\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\W}[1]{ \; #1 \; }\)
replace_table#
View page sourceReplace A a Table#
Syntax#
dismod_at.replace_table
( connection , tbl_name , table_dict )
connection#
is a connection for this database.
table_name#
is a str
that specifies the name of a table that already in the
database.
table_dict#
is a list
with each element of the list is a dictionary.
Each dictionary contains a key for every column name in the original table.
The columns in the original table are written to the new table with the
same order and types as in the original table. Only the values are replaced
using the values in table_dict .
Primary Key#
This routine assumes the primary key is an integer, corresponds
to the first column, and has name tbl_name _ id
.
Example#
The file replace_table.py is an example use of
replace_table
.