Skip to content

Base Expression Types

These APIs are shared by both table and column expressions.

Expr

Base expression class

Methods

compile(self, limit=None, timecontext=None, params=None)

Compile to an execution target.

Parameters

limit An integer to effect a specific row limit. A value of None means "no limit". The default is in ibis/config.py. timecontext Defines a time range of (begin, end). When defined, the execution will only compute result for data inside the time range. The time range is inclusive of both endpoints. This is conceptually same as a time filter. The time column must be named 'time' and should preserve across the expression. For example, if that column is dropped then execute will result in an error. params Mapping of scalar parameter expressions to value

execute(self, limit='default', timecontext=None, params=None, **kwargs)

Execute an expression against its backend if one exists.

Parameters

limit An integer to effect a specific row limit. A value of None means "no limit". The default is in ibis/config.py. timecontext Defines a time range of (begin, end). When defined, the execution will only compute result for data inside the time range. The time range is inclusive of both endpoints. This is conceptually same as a time filter. The time column must be named 'time' and should preserve across the expression. For example, if that column is dropped then execute will result in an error. params Mapping of scalar parameter expressions to value

pipe(self, f, *args, **kwargs)

Compose f with self.

Parameters

f If the expression needs to be passed as anything other than the first argument to the function, pass a tuple with the argument name. For example, (f, 'data') if the function f expects a 'data' keyword args Positional arguments to f kwargs Keyword arguments to f

Examples

import ibis t = ibis.table([('a', 'int64'), ('b', 'string')], name='t') f = lambda a: (a + 1).name('a') g = lambda a: (a * 2).name('a') result1 = t.a.pipe(f).pipe(g) result1 r0 := UnboundTable[t] a int64 b string a: r0.a + 1 * 2

result2 = g(f(t.a)) # equivalent to the above result1.equals(result2) True

Returns

Expr Result type of passed function

verify(self)

Return True if expression can be compiled to its attached client.

DEPRECATED: verify is deprecated as of v2.0; call Expr.compile and catch TranslationError

visualize(self, format='svg')

Visualize an expression in the browser as an SVG image.

Parameters

format Image output format. These are specified by the graphviz Python library.

Notes

This method opens a web browser tab showing the image of the expression graph created by the code in the ibis.expr.visualize module.

Raises

ImportError If graphviz is not installed.


Last update: February 3, 2022