Skip to content

PostgreSQL

exportbadge

ibis.memtable Support memtable

The PostgreSQL backend supports memtables by constructing a string with the contents of the in-memory object. This will be very inefficient for medium to large in-memory tables. Please file an issue if you observe performance issues when using in-memory tables.

Install

Install ibis and dependencies for the Postgres backend:

pip install 'ibis-framework[postgres]'
conda install -c conda-forge ibis-postgres
mamba install -c conda-forge ibis-postgres

Connect

ibis.postgres.connect

con = ibis.postgres.connect(
    user="username",
    password="password",
    host="hostname",
    port=5432,
    database="database",
)

ibis.postgres.connect is a thin wrapper around ibis.backends.postgres.Backend.do_connect.

Connection Parameters

do_connect(host=None, user=None, password=None, port=5432, database=None, schema=None, url=None, driver='psycopg2')

Create an Ibis client connected to PostgreSQL database.

Parameters:

Name Type Description Default
host str | None

Hostname

None
user str | None

Username

None
password str | None

Password

None
port int

Port number

5432
database str | None

Database to connect to

None
schema str | None

PostgreSQL schema to use. If None, use the default search_path.

None
url str | None

SQLAlchemy connection string.

If passed, the other connection arguments are ignored.

None
driver Literal['psycopg2']

Database driver

'psycopg2'

ibis.connect URL format

In addition to ibis.postgres.connect, you can also connect to Postgres by passing a properly formatted Postgres connection URL to ibis.connect

con = ibis.connect(f"postgres://{user}:{password}@{host}:{port}/{database}")

Last update: August 2, 2023