This documentation describes the integration of MindsDB with PostgreSQL, a powerful, open-source, object-relational database system. The integration allows MindsDB to access data stored in the PostgreSQL database and enhance PostgreSQL with AI capabilities.Documentation Index
Fetch the complete documentation index at: https://docs.mindsdb.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before proceeding, ensure the following prerequisites are met:- Install MindsDB locally via Docker or Docker Desktop.
- To connect PostgreSQL to MindsDB, install the required dependencies following this instruction.
Connection
Establish a connection to your PostgreSQL database from MindsDB by executing the following SQL command:user: The username for the PostgreSQL database.password: The password for the PostgreSQL database.host: The hostname, IP address, or URL of the PostgreSQL server.port: The port number for connecting to the PostgreSQL server.database: The name of the PostgreSQL database to connect to.
schema: The database schema to use. Default is public.sslmode: The SSL mode for the connection.connection_parameters: allows passing any PostgreSQL libpq parameters, such as:- SSL settings: sslrootcert, sslcert, sslkey, sslcrl, sslpassword
- Network and reliability options: connect_timeout, keepalives, keepalives_idle, keepalives_interval, keepalives_count
- Session options: application_name, options, client_encoding
- Any other libpq-supported parameter
Usage
The following usage examples utilize the connection to PostgreSQL made via theCREATE DATABASE statement and named postgresql_conn.
Retrieve data from a specified table by providing the integration name, schema, and table name: