Prev
Next
Index->
contents
reference
index
search
external
Up->
dismod_at
python
get_name_type
get_name_type.py
get_name_type.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
.
get_name_type: Example and Test
#
def get_name_type () :
import dismod_at
#
file_name = 'example.db'
new = True
connection = dismod_at. create_connection ( file_name, new)
cursor = connection. cursor ()
#
# create temp table
col_name = [ 'int_name' , 'real_name' , 'text_name' ]
col_type = [ 'integer' , 'real' , 'text' ]
row_list = [
[ 1 , 2.0 , 'three' ]
]
tbl_name = 'temp'
dismod_at. create_table ( connection, tbl_name, col_name, col_type, row_list)
#
check_name = [ 'temp_id' ] + col_name
check_type = [ 'integer primary key' ] + col_type
#
# get the column names and corresponding types
( col_name, col_type) = dismod_at. get_name_type ( connection, tbl_name)
#
assert col_name == check_name
assert col_type == check_type
#
connection. close ()
print ( 'get_name_type: OK' )
Input File: example/table/get_name_type.py