Basic configuration

If you don’t have your own data, you can load example data from the ibis.examples module:

import ibis

t = ibis.examples.penguins.fetch()
1
Ensure you install Ibis first.
2
Load a dataset from the built-in examples.

Overview

Ibis configuration happens through the ibis.options attribute. Attributes can be get and set like class attributes.

Interactive mode

Ibis out of the box is in deferred mode. Expressions display their internal details when printed to the console.

t.head(3)
r0 := DatabaseTable: penguins
  species           string
  island            string
  bill_length_mm    float64
  bill_depth_mm     float64
  flipper_length_mm int64
  body_mass_g       int64
  sex               string
  year              int64

Limit[r0, n=3]

For a better interactive experience, set the interactive option:

ibis.options.interactive = True

This will cause expressions to be executed immediately when printed to the console.

t.head(3)
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ species  island     bill_length_mm  bill_depth_mm  flipper_length_mm  body_mass_g  sex     year  ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ stringstringfloat64float64int64int64stringint64 │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼─────────────┼────────┼───────┤
│ Adelie Torgersen39.118.71813750male  2007 │
│ Adelie Torgersen39.517.41863800female2007 │
│ Adelie Torgersen40.318.01953250female2007 │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴─────────────┴────────┴───────┘

SQL query execution

If an Ibis table expression has no row limit set using the limit API, a default one is applied to prevent too much data from being retrieved from the query engine. The default is currently 10000 rows, but this can be configured with the sql.default_limit option:

ibis.options.sql.default_limit = 100

Set this to None to retrieve all rows in all queries

Warning

Setting the default limit to None will result in all rows from a query coming back to the client from the backend.

ibis.options.sql.default_limit = None

Verbose option and logging

To see all internal Ibis activity (like queries being executed) set ibis.options.verbose:

ibis.options.verbose = True

By default this information is sent to sys.stdout, but you can set some other logging function:

def cowsay(msg):
    print(f"Cow says: {msg}")


ibis.options.verbose_log = cowsay

Default backend

ibis.options.default_backend controls which backend is used by table expressions returned by top-level functions such as ibis.memtable, ibis.read_csv or ibis.read_parquet.

By default, it points to an instance of DuckDB backend. Assuming the backend dependencies have been installed, it can be updated by passing the name of the backend to ibis.set_backend as follows:

import ibis

expr = ibis.memtable({"column": [0, 1, 2, 3, 4]})
ibis.get_backend(expr)
# <ibis.backends.duckdb.Backend at 0x12fa0fb50>

ibis.set_backend("sqlite")
ibis.get_backend(expr)
# <ibis.backends.sqlite.Backend at 0x158411d10>
<ibis.backends.sqlite.Backend at 0x7fff9cfeac30>
Back to top