Escaping confusion with Python 3 + MySQL

Νίκος Βέργος me.on.nzt at gmail.com
Sun Mar 26 12:01:32 EDT 2017


Currently to avoid any misinformations my code looks as follows:

domain = '.'.join( host.split('.')[-2:] )
domain_query = '%%%s' % domain

cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE %s''', (pID, domain, ref, location, useros, browser, lastvisit, domain_query) )

which as i saiddisplays no error in the error_log output just the 

ProgrammingError(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES (1, 'cyta.gr', '' at line 1")

and i'am totally stuck.



More information about the Python-list mailing list