Hello. Faced such a problem: after installing the psycopg2 module, PyCharm does not want to show hints (autocomplete) when writing code for this module. For the rest of the modules, everything works fine.

For example, I try to get the cursor to the database:

import psycopg2 as db con = db.connect(con_string) cur = con.cur (пусто при нажатии Ctrl + Space) 

If anyone has encountered such a problem and solved it, please give advice.

    1 answer 1

    The IDE does not know the return type connect (it is not listed in the docstring, statically it cannot be output from the code, and there are no annotations there either), so it cannot offer anything. There is a ticket in the PyCharm tracker bug https://youtrack.jetbrains.com/issue/PY-31565

    As a workaround, you can use hands to annotate con , not sure what type there is specifically used, something like that

     from psycopg2._psycopg import connection con: connection = db.connect(con_string) 

    After that, tips will work. In a perfect world, someone has to write a stub package for psycopg2 with annotations of the types of the available API.