\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\W}[1]{ \; #1 \; }\)
get_table_dict#
View page sourceGet All Data From a Table#
Syntax#
table_dict = dismod_at.get_table_dict
( connection , tbl_name )
connection#
is a connection for this database.
tbl_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.
table_dict#
This is a list, with length n_row , where each element
of the list is a dictionary.
For each dictionaries, the set of keys is the column names in the table
(excluding the primary key tbl_name _ id
).
The value table_dict [ i ][ col_name ] corresponds to
and the column with name col_name and primary key
tbl_name _ id
= i .
The python type corresponding to the values in the table are
as follows:
Sql Table |
Python |
|
|
|
|
|
|
|
|
You can determine the type for all the columns in the table using get_name_type .
Example#
The file get_table_dict.py is an example use of
get_table_dict
.