【发布时间】:2022-12-03 07:39:08
【问题描述】:
我收到此错误消息
cursor.execute(query, variables)
psycopg2.errors.SyntaxError: syntax error at end of input
我的代码
data = {
'country': data['country'][x],
'year': data['year'][x].astype(float),
'month': data['month'][x].astype(float)
}
db_connection.execute(
f"""
INSERT INTO my_table (country, year, month) VALUES (%(country)s, %(year)s, %(month)s) ON CONFLICT (country, year, month)
""",
data,
)
【问题讨论】:
标签: python postgresql