Home > MySQL > MySQL Error – Operand should contain 1 column(s)

MySQL Error – Operand should contain 1 column(s)

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:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: