What is the use of having sql file part of your project
I had successfully used sql with pycharm just by writing the query in a string, using {} as place holder and then placing parameters there with .format
Then I saw that you can place the sql script in a separate file, then add it to the project. Indeed that is more comfortable practice especially if the script is long or been used by several different .py files. But I don't understand how to call this script from .py file.
Am i supposed to use the usual python open()?
If I want to execute the script manually, so PyCharm will prompt me for the parameters values, is there a way to do so?
I tried to make PyCharm recognize ${} as parameters, but with no success. I looked at the settings at Tools->Data Base -> User Parameters and it seems all is set,
but when I click View Parameters it says "no parameters present". What am I doing wrong?
请先登录再写评论。
Hi,
>Then I saw that you can place the sql script in a separate file, then add it to the project
Could it be that you've seen something like this instead: https://www.jetbrains.com/help/pycharm/running-sql-scripts.html ?
Here's all the documentation we have on injected SQL statements: https://www.jetbrains.com/help/pycharm/running-injected-sql-statements.html
I don't think there is a way to run SQL injections from another file, other than importing strings from other file using normal Python import statement.
But even using PyCharm professionally, I still find new features here and there from time to time :) So if you have a link showing what you mean, please post it here.