talkpython / mastering-pycharm-course

Course demos and handouts for Talk Python's Effective PyCharm course
https://training.talkpython.fm/courses/explore_pycharm/mastering-pycharm-ide
GNU General Public License v2.0
1.12k stars 716 forks source link

SQL auto-complete doesn't work in Python code in PyCharm 2018.1.4 #14

Closed shalgrim closed 6 years ago

shalgrim commented 6 years ago

I'm as confident as I can be that I followed the instructions here word-for-word, but I just could not get any autocomplete/intellisense functionality going on in the last step where it's supposed to happen in the .py file.

I've got the virtual env set up with requirements installed. That virtual env is the project interpreter. I've got the data source added. I've typed (not pasted) the string in...nothing

I regard this as low priority

mikeckennedy commented 6 years ago

Hi Scott,

First thing to double check, you're definitely using the pro edition not community (which doesn't support this). I'm guessing that's the case as you probably can't add a data source to the community edition but double checking...

Second, this might not work while it's indexing (lower right progress bar) so be sure that's done.

Third, try restarting pycharm. That may make it happier.

Finally, you can clear the project cache entirely under File > Invalidate Cache.

Try these and let me know.

shalgrim commented 6 years ago

Thanks Michael,

I verified/tried all that and I get the same behavior.

Here is a vid in case I'm doing something boneheaded that you can see

mikeckennedy commented 6 years ago

Looks like you're doing everything right. Can you reach out to the PyCharm support folks? I don't see why this is not working.

shalgrim commented 6 years ago

Submitted. Their email says it's ticket 1681937, but the URL they gave me 404's 🤷‍♂️ . Just FYI.

mikeckennedy commented 6 years ago

Thanks for the update. If they have something useful in response, please drop it here in case others run into the same issue.

shalgrim commented 6 years ago

SOLUTION

JetBrains' response

Please check that you have Python IntelliLang plugin enabled in Preferences| Plugins and automatic language injection as on the attached screenshot.

image 12 -1

In my case, I had just one of those unchecked (python:”SQL select/delete/insert/update/create”). Checking that got it working

mikeckennedy commented 6 years ago

Ah of course! Glad you got it working. :)