Re: How to insert multiple rows in SQLite Dbase

2008-04-21 Thread afandi
On Apr 1, 12:22 am, afandi [EMAIL PROTECTED] wrote: On Mar 30, 4:46 am, Gerhard Häring [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: [...] and execute: cur.executemany(insert into log (IP, EntryDate, Requestt, ErrorCode) values (:ip, :date, :request, :errorcode), values)

Re: How to insert multiple rows in SQLite Dbase

2008-04-01 Thread Miki
Thanks regards to your suggestion, but I don't understand why we have to put the IF statement? It's just an example, one possible implementation could be: def parse_data(data): mapping = {} for line in data.splitlines(): if not line.strip(): continue key,

Re: How to insert multiple rows in SQLite Dbase

2008-03-31 Thread afandi
On Mar 30, 4:46 am, Gerhard Häring [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: [...] and execute: cur.executemany(insert into log (IP, EntryDate, Requestt, ErrorCode) values (:ip, :date, :request, :errorcode), values) It's probably worth mentioning that pysqlite's executemany()

Re: How to insert multiple rows in SQLite Dbase

2008-03-31 Thread Gabriel Genellina
En Mon, 31 Mar 2008 11:22:40 -0300, afandi [EMAIL PROTECTED] escribió: On Mar 30, 4:46 am, Gerhard Häring [EMAIL PROTECTED] wrote: The deluxe version with generators could look like this: def parse_logfile(): logf = open(...) for line in logf: if ...: row =

Re: How to insert multiple rows in SQLite Dbase

2008-03-29 Thread Gerhard Häring
Gabriel Genellina wrote: [...] and execute: cur.executemany(insert into log (IP, EntryDate, Requestt, ErrorCode) values (:ip, :date, :request, :errorcode), values) It's probably worth mentioning that pysqlite's executemany() accepts anything iterable for its parameter. So you don't need to

How to insert multiple rows in SQLite Dbase

2008-03-28 Thread afandi
Hi, Generally, it involves SQL statement such as follow INSERT INTO tablename(field1,field2,...fieldn) VALUES ('abc','def'...) If I have data taken from Apache Server Log,let say 100 lines which is printed output of 8 fields such as: data 1 IP: 61.5.65.101 Date: 26/Sep/2007

Re: How to insert multiple rows in SQLite Dbase

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 18:05:29 -0300, afandi [EMAIL PROTECTED] escribió: Generally, it involves SQL statement such as follow INSERT INTO tablename(field1,field2,...fieldn) VALUES ('abc','def'...) If I have data taken from Apache Server Log,let say 100 lines which is