File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6969)
7070from pyiceberg .partitioning import UNPARTITIONED_PARTITION_SPEC , PartitionSpec , assign_fresh_partition_spec_ids
7171from pyiceberg .schema import Schema , assign_fresh_schema_ids
72+ from pyiceberg .serializers import FromInputFile
7273from pyiceberg .table import (
7374 CommitTableRequest ,
7475 CommitTableResponse ,
@@ -1055,6 +1056,24 @@ def list_tables(self, namespace: str | Identifier) -> list[Identifier]:
10551056
10561057 @retry (** _RETRY_ARGS )
10571058 def load_table (self , identifier : str | Identifier ) -> Table :
1059+ tr = self ._load_table (identifier )
1060+ if self .properties .get (PREFER_CLIENT_SIDE_METADATA ):
1061+ metadata_location = tr .metadata_location
1062+ if not metadata_location :
1063+ raise ValueError ("Metadata location is required for client-side metadata loading" )
1064+ io = load_file_io (properties = self .properties , location = metadata_location )
1065+ file = io .new_input (metadata_location )
1066+ metadata = FromInputFile .table_metadata (file )
1067+ return Table (
1068+ identifier = identifier ,
1069+ metadata = metadata ,
1070+ metadata_location = metadata_location ,
1071+ io = self ._load_file_io (metadata .properties , metadata_location ),
1072+ catalog = self ,
1073+ )
1074+ return tr
1075+
1076+ def _load_table (self , identifier : str | Identifier ) -> Table :
10581077 self ._check_endpoint (Capability .V1_LOAD_TABLE )
10591078 params = {}
10601079 if mode := self .properties .get (SNAPSHOT_LOADING_MODE ):
You can’t perform that action at this time.
0 commit comments