Re: Sqlite3. Substitution of names in query.

2009-11-03 Thread Carsten Haese
Lawrence D'Oliveiro wrote: > In message , Carsten > Haese wrote: > >> With all due respect, but if your experience is exclusive to >> MySQL/MySQLdb, your experience means very little for database >> programming practices in general. > > I wonder about the veracity of your claims, because: > >> A

Re: Sqlite3. Substitution of names in query.

2009-11-03 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > With all due respect, but if your experience is exclusive to > MySQL/MySQLdb, your experience means very little for database > programming practices in general. I wonder about the veracity of your claims, because: > And here are the corresponding results on m

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Dennis Lee Bieber wrote: > On Tue, 03 Nov 2009 09:41:10 +1300, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> There is no such parsing overhead. I speak from experience. >> > > >> Look at the BulkInserter class here >>

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Carsten Haese
Lawrence D'Oliveiro wrote: > There is no such parsing overhead. I speak from experience. > > Look at the BulkInserter class here > . I have successfully > used that to insert tens of thousands of records in just a few seconds. Yet > it makes n

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Robert Kern wrote: > On 2009-11-02 14:47 PM, Lawrence D'Oliveiro wrote: > >> For instance, I'm not aware of any database API that lets me do this: >> >> sql.cursor.execute \ >>( >> "update numbers set flags = flags | %(setflags)u where >> project

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Robert Kern
On 2009-11-02 14:47 PM, Lawrence D'Oliveiro wrote: In message, Dennis Lee Bieber wrote: On Sun, 01 Nov 2009 19:08 +1300, Lawrence D'Oliveiro declaimed the following in gmane.comp.python.general: On the grounds that Python has more general and powerful string parameter- substitution mechani

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Dennis Lee Bieber wrote: > On Sun, 01 Nov 2009 19:08 +1300, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> On the grounds that Python has more general and powerful string >> parameter- substitution mechanisms than anything built into any database

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > Lawrence D'Oliveiro wrote: > >> Says someone who hasn't realized where the real inefficiencies are. >> Remember what Tony Hoare told us: "premature optimization is the root of >> all evil". These are databases we're talking about. Real-world databases >> are la

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Carsten Haese
Lawrence D'Oliveiro wrote: > Says someone who hasn't realized where the real inefficiencies are. Remember > what Tony Hoare told us: "premature optimization is the root of all evil". > These are databases we're talking about. Real-world databases are large, and > reside on disk, which is several

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > Lawrence D'Oliveiro wrote: > >> In message , >> Carsten Haese wrote: > >>> On what grounds are you asserting that it's not necessary to mix the >>> two? Please elaborate your point. >> >> On the grounds that Python has more general and powerful string >> param

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Carsten Haese
Lawrence D'Oliveiro wrote: >> On what grounds are you asserting that it's not necessary to mix the >> two? Please elaborate your point. > > On the grounds that Python has more general and powerful string parameter- > substitution mechanisms than anything built into any database API. That statemen

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > Lawrence D'Oliveiro wrote: > >> In message , Carsten >> Haese wrote: >> >>> Lawrence D'Oliveiro wrote: >>> In message , Dennis Lee Bieber wrote: > This way regular string interpolation operations (or whatever Python > 3.x has replaced it

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Carsten Haese
Lawrence D'Oliveiro wrote: > In message , Carsten > Haese wrote: > >> Lawrence D'Oliveiro wrote: >> >>> In message , Dennis >>> Lee Bieber wrote: >>> This way regular string interpolation operations (or whatever Python 3.x has replaced it with) are safe to construct the SQL, leaving onl

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > Lawrence D'Oliveiro wrote: > >> In message , Dennis >> Lee Bieber wrote: >> >>> This way regular string interpolation operations (or whatever Python >>> 3.x has replaced it with) are safe to construct the SQL, leaving only >>> user supplied (or program generat

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Carsten Haese
Lawrence D'Oliveiro wrote: > In message , Dennis Lee > Bieber wrote: > >> This way regular string interpolation operations (or whatever Python >> 3.x has replaced it with) are safe to construct the SQL, leaving only >> user supplied (or program generated) data values to be passed via the >> DB-AP

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Lawrence D'Oliveiro
In message , Dennis Lee Bieber wrote: > This way regular string interpolation operations (or whatever Python > 3.x has replaced it with) are safe to construct the SQL, leaving only > user supplied (or program generated) data values to be passed via the > DB-API parameter system -- so that they ar

Re: Sqlite3. Substitution of names in query.

2009-10-30 Thread Matteo
On Oct 30, 7:27 am, "Diez B. Roggisch" wrote: [snip] > Or even better, by > not doing it at all - because usually, your datamodel is tied to your > program, so the need for this kind of dynamicity shouldn't arise in the > first place. > > Die Perhaps that is true in the majority of cases, but the

Re: Sqlite3. Substitution of names in query.

2009-10-30 Thread Matteo
On Oct 30, 7:10 am, Lacrima wrote: > Hello! > > I use sqlite3 module for my sqlite database. I am trying to substitute > table name in sql query. > > >>> import sqlite3 > >>> con = sqlite3.connect('mydb') > >>> cur = con.execute("select * from table where name='Joe'") > > That's ok > > >>> cur = c

Re: Sqlite3. Substitution of names in query.

2009-10-30 Thread Diez B. Roggisch
Lacrima schrieb: Hello! I use sqlite3 module for my sqlite database. I am trying to substitute table name in sql query. import sqlite3 con = sqlite3.connect('mydb') cur = con.execute("select * from table where name='Joe'") That's ok cur = con.execute("select * from table where name=?", ('Jo