Escaping confusion with Python 3 + MySQL

Νίκος Βέργος me.on.nzt at
Sun Mar 26 22:52:27 EDT 2017

Τη Δευτέρα, 27 Μαρτίου 2017 - 5:43:01 π.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Mon, Mar 27, 2017 at 1:39 PM, Νίκος Βέργος <me.on.nzt at> wrote:
> >> 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?
> >
> > Yes indeed it is.
> > I was just so sure that UPDATE was working like INSERT and i was persistent that the WHERE LIKE clause was cauing this.
> >
> > I'am still surprised that:
> >> mysql> update test_update set (b, c) values (4, 5) where a = 1;
> >
> > is failign to parse. It just seems so undoubtly straightforward and correct syntactically.
> So when people told you to read the docs, what did you do, exactly?
> ChrisA

Its NOT that i have not read it exactly, but for some strange reason i was under the belief that the way i had syntactically typed the UPDATE query was correctly and more consistent and similar to thr INSERT query and it was prefered to me over the other one.

UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"

Its still a mystery to em whay this fails syntactically when at the same time INSERT works like that.

We give each columnn a specific value i don't see why it must only be written as UPDATE visitors SET a=1, b=2, c=3 ... WHERE host LIKE %s.

i knew that would work, but the first way although proven syntactically wrong seems so right .....

More information about the Python-list mailing list