I'm using PyCharm and I have an error on this SQL statement:
SELECT * FROM table WHERE id= %(id)s
The code syntax inspection says:
<expression> expected, got '%'
Is there a way to disable this error message? In other words, how do I make PyCharm recognize placeholders in SQL statements?
Edit
Here is my solution:
For %(id)s
and %s
you have to had %\((\w+)\)s
and %s
in Settings/Preferences | Tools | Database | User parameters
and select All languages
not only SQL
Settings/Preferences | Tools | Database | User parameters
-- you can add custom parameter pattern there. Also make sure that appropriateEnable ...
options are enabled. – Marola\%\(([^$\(\)]*)\)\s
Do you have an idea please? – Martynne()
in actual placeholder%(id)s
are what making it break. I've tried few things and none of them worked. Right now I may only suggest to submit official support ticket at intellij-support.jetbrains.com/hc/en-us/requests/new – Marola%\(([^\$\(\)]*)\)s
does work in the one test case I've tried so far. Most of my code base uses%s
so I've also added that as a pattern. – Interspace