# Backend

## class nominal.ibis.Backend(*args, **kwargs)

Bases: `SQLBackend`, `NoUrl`

Ibis backend executing queries against the Nominal SQL API.

### compiler = <nominal.ibis._backend.NominalCompiler object>

### name = 'nominal'

### supports_python_udfs = False

### supports_temporary_tables = False

### property version: str

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

### workspace_rid: str

### create_table(*args, **kwargs)

Create a new table.

## Parameters

name
:   Name of the new table.

obj
:   An Ibis table expression or pandas table that will be used to
    extract the schema and the data of the new table. If not provided,
    `schema` must be given.

schema
:   The schema for the new table. Only one of `schema` or `obj` can be
    provided.

database
:   Name of the database where the table will be created, if not the
    default.

temp
:   Whether a table is temporary or not

overwrite
:   Whether to clobber existing data

## Returns

Table
:   The table that was created.

Return type:
:   *Table*

### create_view(*args, **kwargs)

Create a view from an Ibis expression.

## Parameters

name
:   The name of the view to create.

obj
:   The Ibis expression to create the view from.

database
:   The database that the view should be created in.

overwrite
:   If [`True`](https://docs.python.org/3/builtins/constants.html#True "(in Python v3.15)"), replace an existing view with the same name.

## Returns

ir.Table
:   A table expression representing the view.

Return type:
:   *Table*

### disconnect()

No-op: the gRPC channel belongs to the NominalClient.

### do_connect(client)

Use an existing client and fetch the SQL catalog.

Parameters:
:   **client** ([*NominalClient*](https://dev.nominal.io/python/ref/generated/nominal.core.NominalClient.md#nominal.core.NominalClient "nominal.core.client.NominalClient"))

    Authenticated Nominal client. Queries run in its default workspace, either the one
    pinned in the profile or the tenant default.

### drop_table(*args, **kwargs)

Drop a table from the backend.

## Parameters

name
:   The name of the table to drop

database
:   The database that the table is located in.

force
:   If [`True`](https://docs.python.org/3/builtins/constants.html#True "(in Python v3.15)"), do not raise an error if the table does not exist.

### drop_view(*args, **kwargs)

Drop a view from the backend.

## Parameters

name
:   The name of the view to drop.

database
:   The database that the view is located in.

force
:   If [`True`](https://docs.python.org/3/builtins/constants.html#True "(in Python v3.15)"), do not raise an error if the view does not exist.

### execute(expr, /, *, params=None, limit=None, **kwargs)

Execute an Ibis expression and return a pandas `DataFrame`, `Series`, or scalar.

## Parameters

expr
:   Ibis expression to execute.

params
:   Mapping of scalar parameter expressions to value.

limit
:   An integer to effect a specific row limit. A value of [`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)") means
    no limit. The default is in `ibis/config.py`.

kwargs
:   Keyword arguments

## Returns

DataFrame | Series | scalar
:   The result of the expression execution.

Return type:
:   [*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")

### get_schema(table_name, *, catalog=None, database=None)

Return type:
:   *Schema*

### list_tables(*, like=None, database=None)

Return the sorted names of the tables in the Nominal SQL catalog.

Parameters:
:   - **like** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      Regular expression; return only names that contain a match.
    - **database** ([*tuple*](https://docs.python.org/3/builtins/stdtypes.html#tuple "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]* *|* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      Ignored. The catalog has a single database.

Return type:
:   [*list*](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")[[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")]

### raw_sql(query)

Return type:
:   *Table*

### to_pyarrow(expr, /, *, params=None, limit=None, **kwargs)

Execute the expression and return its result as a PyArrow Table, ChunkedArray, or Scalar.

Return type:
:   [*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")

### to_pyarrow_batches(expr, /, *, params=None, limit=None, chunk_size=1_000_000, **kwargs)

Execute the expression, streaming record batches without materializing the result.

Closing the reader releases the active query stream.
Errors encountered while reading batches are reported as PyArrow exceptions.

Return type:
:   *RecordBatchReader*
