python-noob - which container is appropriate for later exporting into mySql + matplotlib ?

Cousin Stanley cousinstanley at gmail.com
Thu Apr 11 14:44:12 EDT 2013


Cousin Stanley wrote:

>   The stand-alone sqlite interpreter can first be used
>   to create an empty database named some.sql3 
>   and create a table named  xdata  in that data base .... 
>
>     sqlite3 some.sql3 '.read xdata_create.sql'

  This step can also be done in python
  without using the stand-alone sqlite interpreter ....


# -----------------------------------------

import sqlite3 as DBM

dbc = DBM.connect( 'some.sql3' )

cur = dbc.cursor()

list_sql = [ 
  'create table if not exists xdata ' , 
  '( ' , 
  '  xdate  integer , ' , 
  '  xtime  integer , ' , 
  '  col1   real    , ' , 
  '  col2   integer , ' , 
  '  col3   integer , ' , 
  '  col4   real    , ' , 
  '  col5   integer , ' , 
  '  col6   integer   ' , 
  ') ; ' ]

str_sql = '\n'.join( list_sql ) 

cur.execute( str_sql )

dbc.commit()

dbc.close()


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona




More information about the Python-list mailing list