# print " -- ", nameMatch['id'], nameMatch['last'], nameMatch['first'], nameMatch['lat'], nameMatch['long'] if row['lat'] == nameMatch['lat'] and row['long'] == nameMatch['long']: matches += 1 print "MATCH FOUND! -- ", matches, nameMatch['first'], nameMatch['last'] insertmatchsql = "insert into libertarians_national (national_id, libertarian_id) values ('" + nameMatch['id'] + "', '" + row['SOS_VOTERID'] + "')" # print insertmatchsql cur.execute(insertmatchsql) db.commit() print "Number Processed: ", numberProcessed print "Matches: ", matches db.close() if MyFunctions.query_yes_no("Copy libertarians_national table into default database for later use?"): src_conn = MyFunctions.open_db(dbfile) dest_conn = MyFunctions.open_db(defaultDBfile) MyFunctions.copy_table('libertarians_national',src_conn,dest_conn) end_time = time.time() print("\n<--- Execution time: %s seconds --->" % (end_time - start_time))
print rowsProcessed, ": ", r.status_code, ": ", insertSQL if rowsProcessed % 100 == 0: db.commit() # Commit every 100 requests except: print "Uh oh! Something went wrong!" print r.url print r.json() db.commit() db.close() raise db.commit() # Do final commit db.close() if MyFunctions.query_yes_no("Copy geolocations into default database for later use?"): src_conn = MyFunctions.open_db(dbfile) dest_conn = MyFunctions.open_db(defaultDBfile) MyFunctions.copy_table('locations',src_conn,dest_conn) end_time = time.time() print("\n<--- Execution time: %s seconds --->" % (end_time - start_time))