# For quick install pip install psycopg2-binary # For production-ready install pip install psycopg2 # But it will fail if build prerequesties are not met: # https://www.psycopg.org/docs/install.html#build-prerequisites
Here is what the above code is Doing:
1. Importing the psycopg2 module
2. Creating a connection to the database
3. Creating a cursor object
4. Executing a query
5. Closing the connection