Exemplo n.º 1
0
def Test():
   onceinit(__file__)
   #run the query
   conn = sqlite3.connect('/mnt/nb254_data/db/stackoverflow.db')
   c = conn.cursor()
   c.execute('PRAGMA temp_store=MEMORY')
   c.execute('PRAGMA cache_size=500000')
   result = once(lambda x: runquery(c,x),'''SELECT q.Tags as Tags, MIN(strftime('%s', a.CreationDate)-strftime('%s',q.CreationDate)) as SecondsToFirstAnswer FROM posts as q, posts as a WHERE q.PostTypeId = 1;''') # LIMIT 100000
Exemplo n.º 2
0
def DBConnect(dbname):
   onceinit(__file__)
   #run the query
   conn = sqlite3.connect(DIR + dbname + '.db')
   c = conn.cursor()
   c.execute('PRAGMA temp_store=MEMORY')
   c.execute('PRAGMA cache_size=500000')
   return c