song = dict()
song['title'] = 'song 1'
song['artist'] = 'artist 1'
cols = list(songs.keys())
vals = [song[x] for x in cols]
vals_str_list = ['%s'] * len(vals)
vals_str = ', '.join(vals_str_list)
cursor.execute('INSERT INTO song_table ({cols}) VALUES ({vals_str})'.format
    (cols=cols, vals_str=vals_str), vals)
Вставьте словарь Python, используя Psycopg2