ProgrammingError: can't adapt type 'set' ProgrammingError: can't adapt type 'set' postgresql postgresql

ProgrammingError: can't adapt type 'set'


your query seem to expect all strings:

query = """INSERT INTO "Python".hcsdata (DCAD_Prop_ID,Address,Addition, Block, Lot,Permit_Num,Permit_Date, Foundation_Date, Frame_Date, Final_Date, HCS,Project_ID)VALUES (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s)"""

In your values there are almost only strings but an alien stands out:

values = (DCAD_Prop_ID,set(Address),Addition, Block, Lot,Permit_Num,Permit_Date, Foundation_Date, Frame_Date, Final_Date, HCS,Project_ID)

I admit the message is cryptic, but the logic tells us to do just:

values = (DCAD_Prop_ID,Address,Addition, Block, Lot,Permit_Num,Permit_Date, Foundation_Date, Frame_Date, Final_Date, HCS,Project_ID)

(since there's no need to put Address in a set, it seems to be a string like the other fields)


For future people perhaps trying to use e.g. varchar[] or WHERE x IN %(values)s, you need to convert the set to a tuple.