hopsworks.core.trino_catalog_api #
TrinoCatalogApi #
Trino catalogs of the current project, and the query engine restart that loads them.
A catalog makes an external source queryable from the query engine. Creating one records the change; it becomes queryable once the query engine restarts, which happens on the cluster's schedule or immediately when a cluster administrator asks for it.
Returned by
create_catalog #
create_catalog(
name: str,
connector_type: str,
properties: dict[str, str],
data_source_name: str | None = None,
featurestore_id: int | None = None,
) -> dict[str, Any]
Create a Trino catalog.
The catalog is recorded now and becomes queryable when the query engine restarts. Check get_capabilities()["nextScheduledRestart"] for when that is, or call restart() as a cluster administrator to do it immediately.
| PARAMETER | DESCRIPTION |
|---|---|
name | Full catalog name. It must start with TYPE: |
connector_type | A Trino connector from TYPE: |
properties | Connector properties, without |
data_source_name | Derive credential properties from this data source, for a catalog built from TYPE: |
featurestore_id | The data source's feature store. Required with TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] | The created catalog, including the |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If only one of |
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
delete_catalog #
delete_catalog(name: str) -> None
Delete a catalog.
The catalog stays queryable until the query engine restarts and unloads it.
| PARAMETER | DESCRIPTION |
|---|---|
name | The catalog's full name, including the TYPE: |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
get_capabilities #
What this cluster's query engine supports, and when it next restarts.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] |
|
dict[str, Any] | test is possible, |
dict[str, Any] | as the instant a pending catalog next goes live (null when no restart is scheduled), and |
dict[str, Any] |
|
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
get_catalog #
One catalog with its properties, for inspection or editing.
Secret-bearing property values come back masked (********). Submitting a masked value unchanged through update_catalog keeps the stored secret, so a masked property does not have to be retyped to change a different one.
| PARAMETER | DESCRIPTION |
|---|---|
name | The catalog's full name, including the TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] | The catalog: its |
dict[str, Any] |
|
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
get_catalog_template #
A proposed catalog derived from a data source, to be reviewed and then created.
Nothing is created or written by asking for this. Credential properties come back as a reference to a Hopsworks secret or credential-file bundle rather than a value: the value is read from the data source when the catalog is created, so no credential is sent here.
| PARAMETER | DESCRIPTION |
|---|---|
data_source_name | Name of the data source (storage connector) to derive from. TYPE: |
featurestore_id | The feature store the data source belongs to. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] |
|
dict[str, Any] |
|
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
get_catalogs #
The project's Trino catalogs, plus the cluster's shared default catalogs.
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]] | One entry per catalog: its |
list[dict[str, Any]] |
|
list[dict[str, Any]] | use |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
restart #
Apply every pending catalog change now, instead of waiting for the schedule.
Requires cluster administrator (HOPS_ADMIN) privileges; the backend refuses otherwise. This interrupts queries running anywhere on the cluster, so prefer waiting for get_capabilities()["nextScheduledRestart"] unless the change is needed sooner.
Pending changes are written and the query engine is then restarted, in that order: a restart on its own would load nothing, because a newly created catalog is only a record until it is written.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] |
|
dict[str, Any] | any catalog removed because the engine could not load it. A quarantined catalog is not |
dict[str, Any] | applied; its own page carries the load error. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the user is not a cluster administrator, or the backend encounters an error when handling the request. |
test_connection #
test_connection(
name: str,
connector_type: str,
properties: dict[str, str],
data_source_name: str | None = None,
featurestore_id: int | None = None,
) -> None
Check that a catalog definition can actually reach its source, without creating it.
Available only where get_capabilities()["testConnectionAvailable"] is true, which needs the cluster's optional test coordinator. Returns nothing on success and raises with the engine's own message on failure, so a bad host or credential is reported before the catalog exists.
| PARAMETER | DESCRIPTION |
|---|---|
name | Full catalog name, as it would be created. TYPE: |
connector_type | A Trino connector from TYPE: |
properties | The connector properties to test, as they would be stored. |
data_source_name | Resolve credential properties from this data source, exactly as TYPE: |
featurestore_id | The data source's feature store. Required with TYPE: |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If only one of |
hopsworks.client.exceptions.RestAPIError | If the connection fails, or the backend encounters an error when handling the request. |
update_catalog #
Change an existing catalog's connector or properties.
Like a create, the change takes effect at the next query engine restart. A property left at its masked value keeps the secret already stored for it, which is how an update changes one property without retyping the others' credentials.
| PARAMETER | DESCRIPTION |
|---|---|
name | The catalog's full name, including the TYPE: |
connector_type | The Trino connector the catalog uses. TYPE: |
properties | The full set of connector properties to store, as from |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] | The updated catalog, including the |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |