Exemplo n.º 1
0
def db_fill(cursor, logfilename):

	header = parserLog.main(logfilename).next().__dict__.keys()
	for parsed in parserLog.main(logfilename):
		logdata = parsed.__dict__.values()
		#print logdata, header
		#print 'INSERT INTO apacheLogs (\"'+'\", \"'.join(header)+'\") VALUES (\"'+'\", \"'.join(logdata)+'\")'
		cursor.execute('INSERT INTO apacheLogs (\"'+'\", \"'.join(header)+'\") VALUES (\"'+'\", \"'.join(logdata)+'\")')
Exemplo n.º 2
0
def db_init(cursor, logfilename):

	header = parserLog.main(logfilename).next().__dict__.keys()
	q=''
	for h in header: q=q+' '+h+' TEXT,'
	q1 = q.rstrip(",")
	cursor.execute("create table apacheLogs("+q1+")")