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 .
Get Data From a Table

Syntax
connection
table_name
col_name
row_list
Example

Syntax
row_list = dismod_at.get_row_list( connectiontbl_namecol_name)

connection
is a connection for this database.

table_name
is a str that specifies the name of the table. We use the notation n_row for the number of rows in the table.

col_name
is a list of strings containing the names of the columns that we are retrieving data from. We use the notation n_col for the number of columns in col_name . You can determine the name of all the columns in the table using get_name_type .

row_list
This is a list, with length n_row , where each element of the list is a list. In addition, for each i , row_list[i] is a list with length n_col . The value row_list[i][j] corresponds to primary key tbl_name_id = i , and column col_name[j] . The python type corresponding to the values in the table are as follows:
Sql Table    Python
integer int
real float
text str
null None
You can determine the type for all the columns in the table using get_name_type . Note that the type integer primary key corresponds to integer above.

Example
The file get_row_list.py is an example use of get_row_list.
Input File: python/dismod_at/get_row_list.py