song = {'title': 'song 1', 'artist': 'artist 1'}
columns = list(song.keys())
values = [song[column] for column in columns]
insert_statement = 'insert into song_table (%s) values %s'
print(cursor.mogrify(insert_statement, (AsIs(','.join(columns)), tuple(values))
    ))
Insert Python Dictionary using Psycopg2