querydb.py
1 |
#!/usr/bin/python2.6
|
---|---|
2 |
|
3 |
import os |
4 |
import re |
5 |
import sqlite3 |
6 |
from datetime import datetime |
7 |
|
8 |
conn = sqlite3.connect('data.db')
|
9 |
cursor = conn.cursor() |
10 |
|
11 |
start = datetime.now() |
12 |
cursor.execute('SELECT rowid, * FROM sip_trace WHERE packet MATCH "4a14e48dbc421d5b3521d1247fdb41871248e96f"')
|
13 |
data = [] |
14 |
while True: |
15 |
rows = cursor.fetchmany() |
16 |
if not rows: |
17 |
break
|
18 |
for row in rows: |
19 |
data.append(row) |
20 |
end = datetime.now() |
21 |
print len(data), (end-start) |
22 |
conn.close() |