MySQL + pymysql : SQL syntax highlighter stumbles on %s and %(parameter_name)s bind variables in SQL

When I do

import pymysql
# obtain connection .. 
cursor.execute("INSERT INTO t (a,b) VALUES (%s, %d)", (a, b))


or
import pymysql
# obtain connection .. 
params = { 'a' : a, 'b' : b }
cursor.execute("INSERT INTO t (a,b) VALUES (%(a)s, %(b)d)", params)


PyCharm EAP 3 130.1451 highlights %s and %d as an error. Dialect is set to MySQL..
0
Hi Umberto,

PyMySQL is an SQL dialect that is not supported in PyCharm. Please vote for http://youtrack.jetbrains.com/issue/PY-10494 to receive updates on this issue.
You could also set <SQL Keywords> as SQL dialect to not highlight %s and %d as an error
0

I just upvoted this issue. But I also don't understand Ekaterina's comment about setting <SQL Keywords> as the SQL dialect. On my Pycharm there is no <SQL Keywords> in the dialect drop-down. The closest I can see is <Generic> which is what causes the inspection for carp in the first place.

0

I have the same issue - and do not understand Ekaterina's comment - is there any way to stop PyCharm indicating that %s is an error

0

I have the same issue.

0

请先登录再写评论。