Re: pySQLite Insert speed

2008-03-04 Thread Steve Holden
mmm wrote: > Oops I did make a mistake. The code I wanted to test should have been > > import copy > print 'Test 1' > pf= '?,?,?,?' > sqlx1= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf > print sqlx1 > > print > print 'Test 2' > sqlx2= copy.copy(sqlx1) > sqlx3= sqlx1 > pf= '?,?,?, ' > print 'sq

Re: pySQLite Insert speed

2008-03-04 Thread mmm
Oops I did make a mistake. The code I wanted to test should have been import copy print 'Test 1' pf= '?,?,?,?' sqlx1= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf print sqlx1 print print 'Test 2' sqlx2= copy.copy(sqlx1) sqlx3= sqlx1 pf= '?,?,?, ' print 'sqlx1= ', sqlx1 print 'sqlx2= ', sqlx2 pr

Re: pySQLite Insert speed

2008-03-04 Thread Steve Holden
Peter Otten wrote: > Steve Holden wrote: > >> What I will repeat, however, is that while there is a *slight* >> difference is semantics between >> >> s = "some string" >> s1 = s >> >> and >> >> s = "some string" >> s1 = copy.copy(s) >> >> that difference is only to ensure that s and s1 point to di

Re: pySQLite Insert speed

2008-03-04 Thread Peter Otten
Steve Holden wrote: > What I will repeat, however, is that while there is a *slight* > difference is semantics between > > s = "some string" > s1 = s > > and > > s = "some string" > s1 = copy.copy(s) > > that difference is only to ensure that s and s1 point to different > copies of the same st

Re: pySQLite Insert speed

2008-03-04 Thread Steve Holden
mmm wrote: > Steve, I think you were right the first time is saying > >> it should really be this: >> sqlxb= 'INSERT INTO DTABLE2 VALUES (?, ?, ?, ?)' > > my copy.copy() has the equivalent effect. > > Running this test code produces the output below > > import copy > > print 'Test 1' > pf= '?

Re: pySQLite Insert speed

2008-03-04 Thread mmm
Steve, I think you were right the first time is saying > it should really be this: > sqlxb= 'INSERT INTO DTABLE2 VALUES (?, ?, ?, ?)' my copy.copy() has the equivalent effect. Running this test code produces the output below import copy print 'Test 1' pf= '?,?,?,?' sqlx1= 'INSERT INTO DTABLE

Re: pySQLite Insert speed

2008-03-03 Thread Steve Holden
mmm wrote: >>> Hence (if I understand python convention), this can be >>> solved by adding >>> sqlx= copy.copy(sqlx) >>> before the looping. And in tests adding this step saved about 5-10% in >>> time. >> Now this I don;t really understand at all. What's the point of trying to >> replace sqlx with

Re: pySQLite Insert speed

2008-03-03 Thread mmm
> > Hence (if I understand python convention), this can be > > solved by adding > > sqlx= copy.copy(sqlx) > > before the looping. And in tests adding this step saved about 5-10% in > > time. > > Now this I don;t really understand at all. What's the point of trying to > replace sqlx with a copy of

Re: pySQLite Insert speed

2008-03-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I hav read on this forum that SQL coding (A) below is preferred over > (B), but I find (B) is much faster (20-40% faster) > > (A) > > sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values > curs.execute(sqla) > > (B) > pf= '?, ?, ?, ?' > sql

Re: pySQLite Insert speed

2008-03-01 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steve, I want to make sure I understand. My test code is below, where > ph serves as a placeholder. I am preparing for a case where the number > of ? will be driven by the length of the insert record (dx) > > dtable= 'DTABLE3' > print 'Insert data into table %s, versio

Re: pySQLite Insert speed

2008-03-01 Thread mdboldin
Steve, I want to make sure I understand. My test code is below, where ph serves as a placeholder. I am preparing for a case where the number of ? will be driven by the length of the insert record (dx) dtable= 'DTABLE3' print 'Insert data into table %s, version #3' % dtable ph= '?, ?, ?, ?' sqlx=

Re: pySQLite Insert speed

2008-02-29 Thread Tim Roberts
[EMAIL PROTECTED] wrote: > >I hav read on this forum that SQL coding (A) below is preferred over >(B), but I find (B) is much faster (20-40% faster) > >(A) > >sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values >curs.execute(sqla) > >(B) > pf= '?, ?, ?, ?' >sqlxb= 'INSERT

Re: pySQLite Insert speed

2008-02-29 Thread Steve Holden
[EMAIL PROTECTED] wrote: >> (B) is better than (A). The parameter binding employed in (B) >> is not only faster on many databases, but more secure. > See, for example,http://informixdb.blogspot.com/2007/07/filling-in- > blanks.html > > Thx. The link was helpful, and I think I have read similar th

Re: pySQLite Insert speed

2008-02-29 Thread mdboldin
> (B) is better than (A). The parameter binding employed in (B) > is not only faster on many databases, but more secure. See, for example,http://informixdb.blogspot.com/2007/07/filling-in- blanks.html Thx. The link was helpful, and I think I have read similar things before-- that B is faster. So

Re: pySQLite Insert speed

2008-02-28 Thread Carsten Haese
On Thu, 28 Feb 2008 19:35:03 -0800 (PST), mdboldin wrote > I hav read on this forum that SQL coding (A) below is preferred over > (B), but I find (B) is much faster (20-40% faster) > > (A) > > sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values > curs.execute(sqla) > > (B) >

pySQLite Insert speed

2008-02-28 Thread mdboldin
I hav read on this forum that SQL coding (A) below is preferred over (B), but I find (B) is much faster (20-40% faster) (A) sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values curs.execute(sqla) (B) pf= '?, ?, ?, ?' sqlxb= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf