@@ -389,8 +389,8 @@ def _create_hive_table(self, open_client: Client, hive_table: HiveTable) -> None
389
389
390
390
def _get_hive_table (self , open_client : Client , database_name : str , table_name : str ) -> HiveTable :
391
391
try :
392
- return open_client .get_table ( dbname = database_name , tbl_name = table_name )
393
- except NoSuchObjectException as e :
392
+ return open_client .get_tables ( db_name = database_name , pattern = table_name ). pop ( )
393
+ except IndexError as e :
394
394
raise NoSuchTableError (f"Table does not exists: { table_name } " ) from e
395
395
396
396
def create_table (
@@ -435,7 +435,10 @@ def create_table(
435
435
436
436
with self ._client as open_client :
437
437
self ._create_hive_table (open_client , tbl )
438
- hive_table = open_client .get_table (dbname = database_name , tbl_name = table_name )
438
+ try :
439
+ hive_table = open_client .get_tables (db_name = database_name , pattern = table_name ).pop ()
440
+ except IndexError as e :
441
+ raise NoSuchObjectException ("get_table failed: unknown result" ) from e
439
442
440
443
return self ._convert_hive_into_iceberg (hive_table )
441
444
@@ -465,7 +468,10 @@ def register_table(self, identifier: Union[str, Identifier], metadata_location:
465
468
tbl = self ._convert_iceberg_into_hive (staged_table )
466
469
with self ._client as open_client :
467
470
self ._create_hive_table (open_client , tbl )
468
- hive_table = open_client .get_table (dbname = database_name , tbl_name = table_name )
471
+ try :
472
+ hive_table = open_client .get_tables (db_name = database_name , pattern = table_name ).pop ()
473
+ except IndexError as e :
474
+ raise NoSuchTableError (f"Table does not exists: { table_name } " ) from e
469
475
470
476
return self ._convert_hive_into_iceberg (hive_table )
471
477
@@ -656,7 +662,10 @@ def rename_table(self, from_identifier: Union[str, Identifier], to_identifier: U
656
662
to_database_name , to_table_name = self .identifier_to_database_and_table (to_identifier )
657
663
try :
658
664
with self ._client as open_client :
659
- tbl = open_client .get_table (dbname = from_database_name , tbl_name = from_table_name )
665
+ try :
666
+ tbl = open_client .get_tables (db_name = from_database_name , pattern = from_table_name ).pop ()
667
+ except IndexError as e :
668
+ raise NoSuchObjectException ("get_table failed: unknown result" ) from e
660
669
tbl .dbName = to_database_name
661
670
tbl .tableName = to_table_name
662
671
open_client .alter_table_with_environment_context (
@@ -819,3 +828,4 @@ def drop_view(self, identifier: Union[str, Identifier]) -> None:
819
828
def _get_default_warehouse_location (self , database_name : str , table_name : str ) -> str :
820
829
"""Override the default warehouse location to follow Hive-style conventions."""
821
830
return self ._get_hive_style_warehouse_location (database_name , table_name )
831
+
0 commit comments