Escaping confusion with Python 3 + MySQL

INADA Naoki songofacandy at gmail.com
Sun Mar 26 19:26:58 EDT 2017


> i dont have to update table set column1 = this value, column2=that value and
> so on

Why do you think so?  Did you really read the manual?

mysql> create table test_update (a int primary key, b int, c int);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into test_update values (1, 2, 3);
Query OK, 1 row affected (0.00 sec)

mysql> update test_update set (b, c) values (4, 5) where a = 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '(b, c) values (4, 5) where a = 1' at line 1

mysql> update test_update set b=4, c=5 where a = 1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

>
> It's just when the LIKE clause jumps in that is causing all this trouble....

Your MariaDB said:

> check the manual that corresponds to your MariaDB server version for the right syntax to use near '(pagesID, host, ...

MariaDB / MySQL shows part of your SQL from where they failed to parse.
In your case, your MariaDB can't parse from '('
LIKE clause is not problem for this issue?


More information about the Python-list mailing list