gravitino.client.gravitino_metalake.GravitinoMetalake¶
- class gravitino.client.gravitino_metalake.GravitinoMetalake(metalake: MetalakeDTO | None = None, client: HTTPClient | None = None)¶
Bases:
MetalakeDTO
Gravitino Metalake is the top-level metadata repository for users. It contains a list of catalogs as sub-level metadata collections. With GravitinoMetalake, users can list, create, load, alter and drop a catalog with specified identifier.
- __init__(metalake: MetalakeDTO | None = None, client: HTTPClient | None = None)¶
Methods
__init__
([metalake, client])alter_catalog
(name, *changes)Alter the catalog with specified name by applying the changes.
audit_info
()comment
()The comment of the metalake.
create_catalog
(name, catalog_type, provider, ...)Create a new catalog with specified name, catalog type, comment and properties.
disable_catalog
(name)Disable the catalog with specified name.
drop_catalog
(name[, force])Drop the catalog with specified name.
enable_catalog
(name)Enable the catalog with specified name.
equals
(other)from_dict
(kvs, *[, infer_missing])from_json
(s, *[, parse_float, parse_int, ...])List all the catalogs under this metalake.
List all the catalogs with their information under this metalake.
load_catalog
(name)Load the catalog with specified name.
name
()The name of the metalake.
The properties of the metalake.
property_equal
(p1, p2)schema
(*[, infer_missing, only, exclude, ...])to_dict
([encode_json])to_json
(*[, skipkeys, ensure_ascii, ...])Attributes
API_METALAKES_CATALOGS_PATH
dataclass_json_config
rest_client
- alter_catalog(name: str, *changes: CatalogChange) Catalog ¶
Alter the catalog with specified name by applying the changes.
- Args:
name: the name of the catalog. changes: the changes to apply to the catalog.
- Raises:
NoSuchCatalogException if the catalog with specified name does not exist. IllegalArgumentException if the changes are invalid.
- Returns:
the altered Catalog.
- comment() str ¶
The comment of the metalake. Note. this method will return None if the comment is not set for this metalake.
- Returns:
Optional[str]: The comment of the metalake.
- create_catalog(name: str, catalog_type: Type, provider: str, comment: str, properties: Dict[str, str]) Catalog ¶
Create a new catalog with specified name, catalog type, comment and properties.
- Args:
name: The name of the catalog. catalog_type: The type of the catalog. provider: The provider of the catalog. comment: The comment of the catalog. properties: The properties of the catalog.
- Raises:
NoSuchMetalakeException if the metalake does not exist. CatalogAlreadyExistsException if the catalog with specified name already exists.
- Returns:
The created Catalog.
- disable_catalog(name: str)¶
Disable the catalog with specified name. If the catalog is already disabled, this method does nothing.
- Args:
name: the name of the catalog.
- Raises:
NoSuchCatalogException if the catalog with specified name does not exist.
- drop_catalog(name: str, force: bool = False) bool ¶
Drop the catalog with specified name.
- Args:
name: the name of the catalog. force: whether to force drop the catalog.
- Returns:
true if the catalog is dropped successfully, false if the catalog does not exist.
- enable_catalog(name: str)¶
Enable the catalog with specified name. If the catalog is already in use, this method does nothing.
- Args:
name: the name of the catalog.
- Raises:
NoSuchCatalogException if the catalog with specified name does not exist.
- list_catalogs() List[str] ¶
List all the catalogs under this metalake.
- Raises:
NoSuchMetalakeException if the metalake with specified namespace does not exist.
- Returns:
A list of the catalog names under this metalake.
- list_catalogs_info() List[Catalog] ¶
List all the catalogs with their information under this metalake.
- Raises:
NoSuchMetalakeException if the metalake with specified namespace does not exist.
- Returns:
A list of Catalog under the specified namespace.
- load_catalog(name: str) Catalog ¶
Load the catalog with specified name.
- Args:
name: The name of the catalog to load.
- Raises:
NoSuchCatalogException if the catalog with specified name does not exist.
- Returns:
The Catalog with specified name.
- name() str ¶
The name of the metalake.
- Returns:
str: The name of the metalake.
- properties() Dict[str, str] ¶
The properties of the metalake. Note, this method will return None if the properties are not set.
- Returns:
Optional[Dict[str, str]]: The properties of the metalake.