gravitino.api.rel.view_catalog.ViewCatalog

class gravitino.api.rel.view_catalog.ViewCatalog

Bases: ABC

The ViewCatalog interface defines the public API for managing views in a schema.

If the catalog implementation supports views, it must implement this interface.

__init__()

Methods

__init__()

alter_view(identifier, *changes)

Alter a view in the catalog.

create_view(identifier, columns, representations)

Create a view in the catalog.

drop_view(identifier)

Drop a view from the catalog.

list_views(namespace)

List the views in a namespace from the catalog.

load_view(identifier)

Load view metadata by NameIdentifier from the catalog.

view_exists(identifier)

Check if a view with the given name exists in the catalog.

abstract alter_view(identifier: NameIdentifier, *changes: ViewChange) → View

Alter a view in the catalog.

Args:

identifier (NameIdentifier): A view identifier. *changes:

View changes to apply to the view.

Returns:

View: The updated view metadata.

Raises:
NoSuchViewException:

If the view does not exist.

IllegalArgumentException:

If the change is rejected by the implementation.

abstract create_view(identifier: NameIdentifier, columns: list[gravitino.api.rel.column.Column], representations: list[gravitino.api.rel.representation.Representation], comment: str | None = None, default_catalog: str | None = None, default_schema: str | None = None, properties: dict[str, str] | None = None) → View

Create a view in the catalog.

Args:
identifier (NameIdentifier):

A view identifier.

columns (list[Column]):

The columns of the new view.

representations (list[Representation]):

The representations of the view. At least one representation is expected.

comment (str, optional):

The view comment. Defaults to None.

default_catalog (str, optional):

The default catalog name used to resolve unqualified objects in the view. Defaults to None.

default_schema (str, optional):

The default schema name used to resolve unqualified objects in the view. Defaults to None.

properties (dict[str, str], optional):

The view properties. Defaults to None.

Returns:
View:

The created view metadata.

Raises:
NoSuchSchemaException:

If the schema does not exist.

ViewAlreadyExistsException:

If the view already exists.

abstract drop_view(identifier: NameIdentifier) → bool

Drop a view from the catalog.

Args:

identifier (NameIdentifier): A view identifier.

Returns:

bool: True if the view is dropped, False if the view does not exist.

abstract list_views(namespace: Namespace) → list[gravitino.name_identifier.NameIdentifier]

List the views in a namespace from the catalog.

Args:

namespace (Namespace): A namespace.

Returns:

list[NameIdentifier]: An array of view identifiers in the namespace.

Raises:

NoSuchSchemaException: If the schema does not exist.

abstract load_view(identifier: NameIdentifier) → View

Load view metadata by NameIdentifier from the catalog.

Args:

identifier (NameIdentifier): A view identifier.

Returns:

View: The view metadata.

Raises:

NoSuchViewException: If the view does not exist.

view_exists(identifier: NameIdentifier) → bool

Check if a view with the given name exists in the catalog.

Args:

identifier: The view identifier.

Returns:

True if the view exists, False otherwise.