我试图将数组作为数组插入到postrges表中。我收到以下错误:
jobsArray = ['Vice President', 'Technical Services Consultant']
db.execute("""INSERT INTO test VALUES (%s)""", (jobsArray,))
TypeError: not all arguments converted during string formatting
我尝试过许多不同的解决方案,推荐stackoverflow,但都没有成功,错误各不相同,但这是最常见的错误。我试着转换成元组,但行为相同。在
我认为Postgres数组语法使用大括号。来源:https://www.postgresql.org/docs/9.1/static/arrays.html
如果您使用的是SQLAlchemy,它可以自动执行转换,但是我相信您需要为您的表创建一个数据模型。在
相关问题 更多 >
编程相关推荐