Prev
Next
Index->
contents
reference
index
search
external
Up->
dismod_at
database
input
option_table
option_table.py
option_table.py
@(@\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
.
option_table: Example and Test
def option_table () :
import dismod_at
import copy
#
file_name = 'example.db'
new = True
connection = dismod_at. create_connection ( file_name, new)
cursor = connection. cursor ()
#
# create the option table
col_name = [ 'option_name' , 'option_value' ]
col_type = [ 'text unique' , 'text' ]
row_list = [
[ 'parent_node_id' , '0' ] ,
[ 'ode_step_size' , '20.0' ] ,
[ 'rate_case' , 'iota_pos_rho_pos' ] ,
[ 'tolerance_fixed' , '1e-8' ] ,
[ 'max_num_iter_fixed' , '100' ] ,
[ 'print_level_fixed' , '0' ] ,
[ 'derivative_test_fixed' , 'second-order' ] ,
]
tbl_name = 'option'
dismod_at. create_table ( connection, tbl_name, col_name, col_type, row_list)
# ----------------------------------------------------------------------
# include primary key in test
check_name = [ tbl_name + '_id' ] + col_name
check_list = list ()
for i in range ( len ( row_list) ) :
check_list. append ( [ i] + row_list[ i] )
#
row_list = dismod_at. get_row_list ( connection, tbl_name, check_name)
assert row_list == check_list
# ----------------------------------------------------------------------
connection. close ()
print ( 'option_table: OK' )
Input File: example/table/option_table.py