How do I make PyCharm recognize placeholders in SQL statements?

后端 未结 2 1079
灰色年华
灰色年华 2021-02-05 07:18

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:

<         


        
2条回答
  •  -上瘾入骨i
    2021-02-05 07:58

    In addition to @Nate's answer (built-in regex %\((\w+)\)s works for PostgreSQL), i've managed to get this work only via reordering the patterns and moving target regex to the top of the list.

    One could also try to disable other rules and see if that helps.

提交回复
热议问题