dedupeio / dedupe-examples

:id: Examples for using the dedupe library
MIT License
404 stars 216 forks source link

run mysql_example.py failure #116

Closed nrajasek1 closed 3 years ago

nrajasek1 commented 3 years ago

when i ran mysql_example.py (only change is instead of mysql using oracle rest all the code is same no change) it is giving following error after

blocking... creating blocking_map database creating inverted index writing blocking map <generator object at 0x000000A4962E6EB0> Traceback (most recent call last):

File "C:\Persistance ID\dedupe-examples-master\dedupe-examples-master\mysql_example\mysql_example.py", line 244, in write_cur.executemany("INSERT INTO blocking_map VALUES (%s, %s)",

TypeError: parameters should be a list of sequences/dictionaries or an integer specifying the number of times to execute the statement

nrajasek1 commented 3 years ago

below are changes made to code to get it working

with read_con.cursor() as read_cur: read_cur.execute(DONOR_SELECT) read_cur.rowfactory = makeDictFactory(read_cur) # added to convert the records to dict full_data = [(row["DONOR_ID"], row) for row in read_cur] #changed from { to [ for outside braces

print(full_data)

    b_data = deduper.fingerprinter(full_data)
    #print(list(b_data))

    with write_con.cursor() as write_cur:

        write_cur.executemany("INSERT INTO blocking_map VALUES (%s, %s)",
                              list(b_data))  #added list befoe b_data