Skip to content

Commit 355f242

Browse files
committed
fix(glue): Return Table directly from create_table instead of re-loading
Avoid a redundant GetTable + GetObject round-trip at the end of create_table and _create_table_s3tables by constructing the Table from the staged metadata that was just written, matching the pattern used in commit_table.
1 parent de9c1b2 commit 355f242

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pyiceberg/catalog/glue.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,13 @@ def _create_table_s3tables(
523523
)
524524
raise
525525

526-
return self.load_table(identifier=identifier)
526+
return Table(
527+
identifier=self.identifier_to_tuple(identifier),
528+
metadata=staged_table.metadata,
529+
metadata_location=staged_table.metadata_location,
530+
io=self._load_file_io(staged_table.metadata.properties, staged_table.metadata_location),
531+
catalog=self,
532+
)
527533

528534
def create_table(
529535
self,
@@ -580,7 +586,13 @@ def create_table(
580586
table_input = _construct_table_input(table_name, staged_table.metadata_location, properties, staged_table.metadata)
581587
self._create_glue_table(database_name=database_name, table_name=table_name, table_input=table_input)
582588

583-
return self.load_table(identifier=identifier)
589+
return Table(
590+
identifier=self.identifier_to_tuple(identifier),
591+
metadata=staged_table.metadata,
592+
metadata_location=staged_table.metadata_location,
593+
io=self._load_file_io(staged_table.metadata.properties, staged_table.metadata_location),
594+
catalog=self,
595+
)
584596

585597
def register_table(self, identifier: str | Identifier, metadata_location: str) -> Table:
586598
"""Register a new table using existing metadata.

0 commit comments

Comments
 (0)