0
在以下代碼中,我想要插入authors
,方法是找到link
。遇到如何使用python將這些數據插入到postgresql中?
self.cur.execute("""
UPDATE articles
SET authors = %s
WHERE link = %s returning id;
""" % (authors, link))
ret_id = self.cur.fetchone()
兩個問題:
有些名字是不是經常這樣的:
LINE 1: UPDATE articles SET authors = Francesco D'Angelo, Roberto T...
當作者姓名都沒有問題:
"""UPDATE articles SET authors = %s WHERE link = %s returning id;""" % (authors, link)) psycopg2.ProgrammingError: syntax error at or near ":" LINE 1: ...DATE articles SET authors = test WHERE link = http://www.wor...