def setUpClass(self):
     remove_existing_databases()
     make_assignee_db()
     make_inventor_db()
     self.conn = sqlite3.connect("hashTbl.sqlite3")
     self.cursor = self.conn.cursor()
     create_sql_helper_functions(self.conn)
     create_hashtbl(self.cursor, self.conn)
 def setUpClass(self):
     remove_existing_databases()
     make_assignee_db()
     make_inventor_db()
     self.conn = sqlite3.connect("hashTbl.sqlite3")
     self.cursor = self.conn.cursor()
     create_sql_helper_functions(self.conn)
     create_hashtbl(self.cursor, self.conn)
示例#3
0
import datetime
# TODO: cover geocode setup functions with unit tests.
import sqlite3
import geocode_setup
# geocode_replace_loc consists of a series of functions,
# each with a SQL statement that is passed as a parameter
# to replace_loc. Uses temporary tables for handling
# intermediate relations.
import geocode_replace_loc

conn = sqlite3.connect("hashTbl.sqlite3")
c = conn.cursor()
geocode_setup.create_sql_helper_functions(conn)

print "Start setup for geocoding: ", datetime.datetime.now()
geocode_setup.create_hashtbl(c, conn)
print "Finish setup for geocoding: ", datetime.datetime.now()

# End of setup.
# Exiting here gets the initial hashTbl.sqlite3 file when
# executed as `python lib/geocode.py`
#exit()

def replace_loc(script):

    c.execute("DROP TABLE IF EXISTS temp1")
    c.execute("CREATE TEMPORARY TABLE temp1 (jaro_match_value FLOAT, count INTEGER, \
        cityA TEXT, stateA TEXT, countryA TEXT, ncity TEXT, nstate TEXT, ncountry TEXT, nlat FLOAT, nlong FLOAT);")
    c.execute("INSERT OR REPLACE INTO temp1 %s;" % script)

    #print_table_info(c)