PyCharm SQL Language Injection support

 ̄綄美尐妖づ 提交于 2019-12-24 06:30:26

问题


I'm writing some python code with the sqlite3 package. I want to put some SQL code into a string literal. As I found here, Python supports Injections with markup and coding assistance for several languages, including SQL:

(such as HTML, CSS, XML, SQL, RegExp, etc.)

Sadly, when I want to try this feature, I found support for several languages like HTML or JQL, but I'm looking for SQL.

According to this post, it should be available since Pycharm 3.0.

Is there any way to get SQL Language injections with markup and coding assistance running?


回答1:


I found a solution to this problem after long search:

Install the plugin Database Navigator. (File->Settings->Plugins->Browse repositories->search for Database Navigator)

This will provide you with support for several SQL dialects including sqlite. Sadly code-completion features don't support upper-case.

This is how the SQL support looks like - first line in proper uppercase, second line as with autocomplete-suggestion in lowercase

EDIT: I could also solve this problem by changing the language settings for SQL:
(File->Settings->Editor->CodeStyle->SQL->enable Case, set uppercase where you wish to)




回答2:


SQL injections are available only in PyCharm Pro version



来源:https://stackoverflow.com/questions/48485507/pycharm-sql-language-injection-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!