To connect and manipulate your PostgreSQL database in Python, you will need a library to assist you. psyscopg2
is that library. It provides a wrapper around the official libpq
client library. In this section, we will cover how to install the library, how to connect to the database, and how to add a table and perform basic geospatial queries.
pscycopg2
is the most popular library for working with PostgreSQL in Python. It fully implements the Python DB API 2.0 specificationand works with Python 3. In the following sections, you will learn how to install the library, make connections, execute queries, and read the results. You can read the full documentation here: http://initd.org/psycopg/docs/