jerryshao commented on code in PR #9478: URL: https://github.com/apache/gravitino/pull/9478#discussion_r2622309248
########## clients/client-python/gravitino/client/relational_catalog.py: ########## @@ -0,0 +1,205 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from typing import Optional + +from gravitino.api.catalog import Catalog +from gravitino.api.rel.column import Column +from gravitino.api.rel.expressions.distributions.distribution import Distribution +from gravitino.api.rel.expressions.sorts.sort_order import SortOrder +from gravitino.api.rel.expressions.transforms.transform import Transform +from gravitino.api.rel.indexes.index import Index +from gravitino.api.rel.table import Table +from gravitino.api.rel.table_catalog import TableCatalog +from gravitino.client.base_schema_catalog import BaseSchemaCatalog +from gravitino.client.relational_table import RelationalTable +from gravitino.dto.audit_dto import AuditDTO +from gravitino.dto.rel.distribution_dto import DistributionDTO +from gravitino.dto.requests.table_create_request import TableCreateRequest +from gravitino.dto.responses.entity_list_response import EntityListResponse +from gravitino.dto.responses.table_response import TableResponse +from gravitino.dto.util.dto_converters import DTOConverters +from gravitino.exceptions.handlers.table_error_handler import TABLE_ERROR_HANDLER +from gravitino.name_identifier import NameIdentifier +from gravitino.namespace import Namespace +from gravitino.rest.rest_utils import encode_string +from gravitino.utils import HTTPClient + + +class RelationalCatalog(BaseSchemaCatalog, TableCatalog): + """Relational catalog is a catalog implementation that supports relational database. + + It's like metadata operations, for example, schemas and tables list, creation, update + and deletion. A Relational catalog is under the metalake. + """ + + def __init__( + self, + catalog_namespace: Namespace, + name: str, + catalog_type: Catalog.Type, + provider: str, + audit: AuditDTO, + rest_client: HTTPClient, + comment: Optional[str] = None, + properties: Optional[dict[str, str]] = None, + ): + super().__init__( + catalog_namespace, + name, + catalog_type, + provider, + comment, + properties, + audit, + rest_client, + ) + + def as_table_catalog(self) -> TableCatalog: + return self + + @staticmethod + def check_table_name_identifier(identifier: NameIdentifier) -> None: Review Comment: This method and the one below will only be used in this class. I think it would be better to not make them `public`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
