Archive

Posts Tagged ‘OperationalError’

MySQL Error – Operand should contain 1 column(s)

March 26, 2012 Leave a comment

Problem:
I was getting the following mysql error in python.
OperationalError: (1241, ‘Operand should contain 1 column(s)’)

Solution:
Convert the python list to a string.

Here is what I was not doing.

>>>my_list
['First', 'Second', 'Third']

Instead of

INSERT INTO table (data) VALUES (str(my_list))

I was doing this

INSERT INTO table (data) VALUES (my_list)

Source:
This helped narrow down the issue.
http://lists.mysql.com/mysql/189034

Advertisements
Categories: MySQL Tags: