Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 33 lines (26 sloc) 0.906 kb
b18a535 initial commit of patentYear and createFullSet
amyzhaoyu authored
1 #This file is meant to separate the patent related datasets by Year
2
3 import sys, datetime, os
4 sys.path.append("/home/ron/PythonBase")
5
6 yr0 = int(sys.argv[1])
7 yr1 = int(sys.argv[2])
8
9 import SQLite
10 import senAdd
11
12 input = '/media/data/ron/disambig/backup'
13 output = '/media/data/ron/disambig/fullset'
14 table = 'patent'
15 yrRng = range(yr0, yr1+1)
16
17 s = SQLite.SQLite(db='%s/patent%d' % (input, yr1))
18 tables = s.tables();
19 s.close()
20
21 for table in tables:
22 if os.path.exists('%s/%s.sqlite3' % (output, table)):
23 print "Appends", table
24 s = SQLite.SQLite(db='%s/%s.sqlite3' % (output, table), tbl=table)
25 s.optimize()
26 for yr in yrRng:
27 s.attach('%s/patent%d' % (input, yr))
28 if s.tables(db='db', lookup=table):
29 s.addSQL(data=table, db='db', insert='IGNORE')
30 print " -", yr, datetime.datetime.now()
31 s.count()
32 s.close()
Something went wrong with that request. Please try again.