No longer possible to run query straight from SQL editor

Answered

Since updating to PyCharm 2020.1, any SQL files can no longer be run "standalone". Ctrl-Enter does not execute the query (nothing happens), and when using Alt-Enter (or light bulb) to attach to a session, a red balloon "Nothing to run" pops up. Most of the buttons in the editor toolbar are disabled:

 

I did find out that when the complete query is selected in the open SQL file, I can run it, not with Ctrl-Enter but with an attached session, but in case there are user parameters in the query, they are ignored and result in syntax errors.

The weird thing is, when copying & pasting the complete query to a console attached to a data source session, it all works fine. User parameter values can be supplied and the query displays its results.

Note that I also attempted Invalidate Cache and Restart, without success.

 

1 comment
Comment actions Permalink

Solved. My bad. The directory that is the root of my SQL resources was NOT marked as a Resources directory in the PyCharm project. Now everything works as before. This may help future readers.

The thing that gave it away for me, was that there was a constant Browser popup in the SQL editor. Somehow PyCharm considered my SQL file as a web/HTML resource... Hence probably also the 'Nothing to run' popup.

1

Please sign in to leave a comment.