I am trying to insert a list of values into a single column and getting the following error:
postgresConnection = psycopg2.connect(
host='x',
user='x',
password='x',
database='x'
)
data = '[12, 37]'
sqlpoptable = ("INSERT INTO datas (conditions) VALUES (?);", data)
cursor.execute(sqlpoptable, data)
postgresConnection.commit()`
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-36-fa661d7bfe6a> in <module>
7 data = '[12, 37]'
8 sqlpoptable = ("INSERT INTO datas (conditions) VALUES (?);", data)
----> 9 cursor.execute(sqlpoptable, data)
10 postgresConnection.commit()
TypeError: argument 1 must be a string or unicode object: got tuple instead
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…