Setting SQL Dialect Within a String or ignoring the warnings?

example that looks like an advertisement for using ORMs :)

  • top10_students_oracle = "SELECT * FROM STUDENTS S WHERE ROWNUM <=10;"
  • top10_students_sqlite = "SELECT * FROM STUDENTS S LIMIT 10;"
  • top10_students_mssql = "SELECT TOP 10 * FROM STUDENTS S;"

With these three variables in the same file, Pycharm treats each as generic for formatting/coloring. As per generic, no code errors are shown.

So far I'm fine with that.

Now all three lines show up as a code warning because they're generic. 

I see that I can set the dialect for a file under "Settings->Languages&Frameworks->SQL Dialects"

Any way to set the dialect for a class or individual string? 

I ended up turning off the introspection entirely because the marks were frequent in a few files and hiding other suggestions.

Please sign in to leave a comment.