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, :er

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, val

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 ...: >>

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 ex

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

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 (field1,field2,...fieldn) VALUES > ('abc','def'...) > > If I have data taken from Apache Server Log,let say 100 lines which > is printe

How to insert multiple rows in SQLite Dbase

2008-03-28 Thread afandi
Hi, Generally, it involves SQL statement such as follow INSERT INTO (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 Time: 20:43: