|
Python Connector for PostgreSQL Connecting to PostgreSQL - Python Connector for PostgreSQL |
|
To establish a connection to a PostgreSQL database, import the connector and use the connect() method with your connection parameters.
First, import the PostgreSQL connector module:
import devart.postgresql as postgresql
Call the connect() method and obtain a connection object.
my_connection = postgresql.connect(
Server="your_server",
Database="your_database",
UserId="your_username",
Password="your_password"
)
Replace the example values with your actual connection values.
For more information, see Connection parameters.