Prev Next

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\W}[1]{ \; #1 \; }@)@ This is dismod_at-20221105 documentation: Here is a link to its current documentation .
Replace A a Table

Syntax
connection
table_name
table_dict
Primary Key
Example

Syntax
dismod_at.replace_table(connectiontbl_nametable_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.
Input File: python/dismod_at/replace_table.py