get_row_list#

View page source

Get Data From a Table#

Syntax#

row_list = dismod_at.get_row_list ( connection , tbl_name , col_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 .