Skip to content

Pandas-like Backend Base Classes

These base classes underlie the pandas-based backends.

BasePandasBackend (BaseBackend)

Base class for backends based on pandas.

Attributes

current_database property readonly

Return the name of the current database.

Backends that don't support different databases will return None.

Returns

str | None Name of the current database.

version: str property readonly

Return the version of the backend engine.

For database servers, return the server version.

For others such as SQLite and pandas return the version of the underlying library or application.

Returns

str The backend version

Classes

Options (BaseModel) pydantic-model

Attributes
enable_trace: bool pydantic-field

Enable tracing for execution.

Methods

compile(self, expr, *args, **kwargs)

Compile an expression.

create_table(self, table_name, obj=None, schema=None)

Create a table.

database(self, name=None)

Return a Database object for the name database.

DEPRECATED: database is deprecated; use equivalent methods in the backend

Parameters

name Name of the database to return the object for.

Returns

Database A database object for the specified database.

from_dataframe(self, df, name='df', client=None)

Construct an ibis table from a pandas DataFrame.

Parameters

df A pandas DataFrame name The name of the pandas DataFrame client Client dictionary will be mutated with the name of the DataFrame, if not provided a new client is created

Returns

Table A table expression

has_operation(operation) classmethod

Return whether the backend implements support for operation.

Parameters

operation A class corresponding to an operation.

Returns

bool Whether the backend implements the operation.

Examples

import ibis import ibis.expr.operations as ops ibis.sqlite.has_operation(ops.ArrayIndex) False ibis.postgres.has_operation(ops.ArrayIndex) True

list_databases(self, like=None)

List existing databases in the current connection.

Parameters

like A pattern in Python's regex format to filter returned database names.

Returns

list[str] The database names that exist in the current connection, that match the like pattern if provided.

list_tables(self, like=None, database=None)

Return the list of table names in the current database.

For some backends, the tables may be files in a directory, or other equivalent entities in a SQL database.

Parameters

like : str, optional A pattern in Python's regex format. database : str, optional The database to list tables of, if not the current one.

Returns

list[str] The list of the table names that match the pattern like.

table(self, name, schema=None)

Return a table expression from the database.

DEPRECATED: table is deprecated as of v2.0; change the current database before calling .table()


Last update: March 1, 2022