Skip to content

MySQL

exportbadge

ibis.memtable Support memtable

The MySQL 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 MySQL backend:

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

Connect

ibis.mysql.connect

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

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

Connection Parameters

do_connect(host='localhost', user=None, password=None, port=3306, database=None, url=None, driver='pymysql', **kwargs)

Create an Ibis client using the passed connection parameters.

Parameters:

Name Type Description Default
host str

Hostname

'localhost'
user str | None

Username

None
password str | None

Password

None
port int

Port

3306
database str | None

Database to connect to

None
url str | None

Complete SQLAlchemy connection string. If passed, the other connection arguments are ignored.

None
driver Literal['pymysql']

Python MySQL database driver

'pymysql'
kwargs

Additional keyword arguments passed to connect_args in sqlalchemy.create_engine. Use these to pass dialect specific arguments.

{}

ibis.connect URL format

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

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

Last update: August 1, 2023