def run_org_clean(): org = orgClean.orgClean(db = 'assignee.sqlite3', fld = 'assigneeAsc', table = 'assignee_1', other = "") org.disambig() print"DONE: orgClean" #print " -", datetime.datetime.now()-t1 # Copy assignee num from grp to assignee table s.merge(key=[['AsgNum', 'AsgNum2']], on=['AssigneeAsc'], tableFrom='grp') print "DONE: Replaced Asgnum!", "\n -", datetime.datetime.now()-t1 s.c.execute("""update assignee_1 set City = cc(city, country, 'city'), Country = cc(city, country, 'ctry');""") s.attach('hashTbl.sqlite3') s.merge(key=['NCity', 'NState', 'NCountry', 'NZipcode', 'NLat', 'NLong'], on=['City', 'State', 'Country'], tableFrom='locMerge', db='db') s.commit() print "DONE: Asg Locationize!", "\n -", datetime.datetime.now()-t1
def run_org_clean(): org = orgClean.orgClean(db='assignee.sqlite3', fld='assigneeAsc', table='assignee_1', other="") org.disambig() print "DONE: orgClean" #print " -", datetime.datetime.now()-t1 # Copy assignee num from grp to assignee table s.merge(key=[['AsgNum', 'AsgNum2']], on=['AssigneeAsc'], tableFrom='grp') print "DONE: Replaced Asgnum!", "\n -", datetime.datetime.now() - t1 s.c.execute( """update assignee_1 set City = cc(city, country, 'city'), Country = cc(city, country, 'ctry');""" ) s.attach('hashTbl.sqlite3') s.merge(key=['NCity', 'NState', 'NCountry', 'NZipcode', 'NLat', 'NLong'], on=['City', 'State', 'Country'], tableFrom='locMerge', db='db') s.commit() print "DONE: Asg Locationize!", "\n -", datetime.datetime.now() - t1
s.c.execute("INSERT INTO assignee_1 SELECT * FROM assignee %s" % (debug and "LIMIT 2500" or "")) s.add('assigneeAsc', 'VARCHAR(30)') s.c.execute("UPDATE assignee_1 SET assigneeAsc = ascit(assignee);") s.commit() print "DONE: assignee_1 table created in assignee.sqlite3 with new column assigneeAsc", "\n -", datetime.datetime.now()-t1 #s.merge(key=[['AsgNum', 'pdpass']], on=[['assigneeAsc', 'assignee']], keyType=['INTEGER'], tableFrom='main', db='db') #s.attach(database = 'NBER_asg') print "Tables call from script ", s.tables() s.merge(key=[['AsgNum', 'pdpass']], on=[['assigneeAsc', 'assignee']], keyType=['INTEGER'], tableFrom='assignee', db='NBER') s.c.execute("UPDATE assignee_1 SET AsgNum=NULL WHERE AsgNum<0") print"DONE: NBER pdpass added to assignee_1 in column AsgNum", "\n -", datetime.datetime.now()-t1 s.commit() ### Run orgClean.py and generate grp org = orgClean.orgClean(db = 'assignee.sqlite3', fld = 'assigneeAsc', table = 'assignee_1', other = "") org.disambig() print"DONE: orgClean" print " -", datetime.datetime.now()-t1 # Copy assignee num from grp to assignee table s.merge(key=[['AsgNum', 'AsgNum2']], on=['AssigneeAsc'], tableFrom='grp') print "DONE: Replaced Asgnum!", "\n -", datetime.datetime.now()-t1 s.c.execute("""update assignee_1 set City = cc(city, country, 'city'), Country = cc(city, country, 'ctry');""") s.attach('hashTbl.sqlite3') s.merge(key=['NCity', 'NState', 'NCountry', 'NZipcode', 'NLat', 'NLong'], on=['City', 'State', 'Country'], tableFrom='locMerge', db='db') s.commit() print "DONE: Asg Locationize!", "\n -", datetime.datetime.now()-t1 s.close()
s.commit() print "DONE: assignee_1 table created in assignee.sqlite3 with new column assigneeAsc", "\n -", datetime.datetime.now( ) - t1 s.merge(key=[['AsgNum', 'pdpass']], on=[['assigneeAsc', 'assignee']], keyType=['INTEGER'], tableFrom='main', db='db') s.c.execute("UPDATE assignee_1 SET AsgNum=NULL WHERE AsgNum<0") print "DONE: NBER pdpass added to assignee_1 in column AsgNum", "\n -", datetime.datetime.now( ) - t1 s.commit() ### Run orgClean.py and generate grp org = orgClean.orgClean(db='assignee.sqlite3', fld='assigneeAsc', table='assignee_1', other="") org.disambig() print "DONE: orgClean" print " -", datetime.datetime.now() - t1 # Copy assignee num from grp to assignee table s.merge(key=[['AsgNum', 'AsgNum2']], on=['AssigneeAsc'], tableFrom='grp') print "DONE: Replaced Asgnum!", "\n -", datetime.datetime.now() - t1 s.c.execute( """update assignee_1 set City = cc(city, country, 'city'), Country = cc(city, country, 'ctry');""" ) s.attach('hashTbl.sqlite3') s.merge(key=['NCity', 'NState', 'NCountry', 'NZipcode', 'NLat', 'NLong'], on=['City', 'State', 'Country'],