File: create_index.py

package info (click to toggle)
libpyzy 1.0.1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,544 kB
  • sloc: python: 23,416; cpp: 20,929; makefile: 346; sql: 94; php: 16; sh: 16
file content (21 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import sqlite3

con2 = sqlite3.connect("py-new.db")
con2.execute ("PRAGMA synchronous = NORMAL;")
con2.execute ("PRAGMA temp_store = MEMORY;")


con2.execute("CREATE INDEX index_0_0 ON py_phrase_0(s0, y0)")
print "py_phrase_%d done" % 0

con2.execute("CREATE INDEX index_1_0 ON py_phrase_1(s0, y0, s1, y1)")
con2.execute("CREATE INDEX index_1_1 ON py_phrase_1(s0, s1, y1)")
print "py_phrase_%d done" % 1

for i in xrange(2, 16):
	con2.execute("CREATE INDEX index_%d_0 ON py_phrase_%d(s0, y0, s1, y1, s2, y2)" % (i, i))
	con2.execute("CREATE INDEX index_%d_1 ON py_phrase_%d(s0, s1, s2, y2)" % (i, i))
	print "py_phrase_%d done" % i

# con2.execute("vacuum")
con2.commit()