1 2
cursor.execute("""INSERT INTO main_reference SET source = %s, url = %s, vulnerability_id = %s""", (k['source'], k['url'], SELECT `id` from other_table limit 1 order by id + 1)