PySQLite Table indexing inside a functions

Kevin kmcbrearty at yahoo.com
Thu Dec 2 17:37:21 EST 2004


Hello Again,

It may be cleaner if I reduce the code:

def PARSE2DB(data,tablename):
   i = 0
   cadu = GETdb().cursor()
   FacetNum = len(data [1])
   while i < FacetNum:
       cadu.execute("""
          insert into table = 'tablename'
           ( V1_x, V1_y, V1_z)
           values(%f, %f, %f)
           """,
	      (data [i][0][0], data [i][0][1]
                ,data[i][0][2]0])
 	)
	i = i + 1
   return 


--- Kevin <kmcbrearty at yahoo.com> wrote:

> Hello Everyone,
> 
> I'm using PySQLite and would like to index this
> insert
> statement with the 'tablename'.  Can anyone offer a
> suggestion?
> 
> Also, this is a shot in the dark.  Has anyone done
> anything with nested fields.  I would like each
> vertex
> to have 3 points.  currently, I'm just making 3
> fields.
> 
> Regards,
>        Kevin
> 
> 
> 
> def PARSE2DB(data,tablename):
>     i = j = k = 0
>     cadu = GETdb().cursor()
>     FacetNum = len(data [1])
>     while i < FacetNum:
> 		cadu.execute("""
> 			insert into table = 'tablename'( V1_x, V1_y,
> V1_z,
> V2_x, V2_y, V2_z,
> 						     V3_x, V3_y, V3_z, N_x, N_y, N_z)
> 					values(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f,
> %f, %f)
> 				""",
> 				(data [1][i][1][0][0], data [1][i][1][0][1],data
> [1][i][1][0][2],
> 			 	data [1][i][1][1][0], data [1][i][1][1][1],data
> [1][i][1][1][2],
>                    	data [1][i][1][2][0], data
> [1][i][1][2][1],data [1][i][1][2][2],
>                    	data [1][i][0][0], data
> [1][i][0][1], data [1][i][0][2])
> 		)
> 		i = i + 1
> 
>     return 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> All your favorites on one personal page – Try My
> Yahoo!
> http://my.yahoo.com 
> 



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 




More information about the Python-list mailing list