@@ -229,6 +229,7 @@ def __init__(
229229 storage_options : Optional [Dict [str , str ]] = None ,
230230 without_files : bool = False ,
231231 log_buffer_size : Optional [int ] = None ,
232+ lazy_load : bool = False
232233 ):
233234 """
234235 Create the Delta Table from a path with an optional version.
@@ -247,9 +248,19 @@ def __init__(
247248 This can decrease latency if there are many files in the log since the last checkpoint,
248249 but will also increase memory usage. Possible rate limits of the storage backend should
249250 also be considered for optimal performance. Defaults to 4 * number of cpus.
250-
251+ lazy_load: when true the table metadata isn't loaded
251252 """
252253 self ._storage_options = storage_options
254+ if lazy_load :
255+ self ._table = RawDeltaTable .load_lazy (
256+ str (table_uri ),
257+ version = version ,
258+ storage_options = storage_options ,
259+ without_files = without_files ,
260+ log_buffer_size = log_buffer_size ,
261+ )
262+ self ._metadata = None
263+ return
253264 self ._table = RawDeltaTable (
254265 str (table_uri ),
255266 version = version ,
@@ -425,6 +436,8 @@ def metadata(self) -> Metadata:
425436 Returns:
426437 the current Metadata registered in the transaction log
427438 """
439+ if not self ._metadata :
440+ self ._metadata = Metadata (self ._table )
428441 return self ._metadata
429442
430443 def protocol (self ) -> ProtocolVersions :
0 commit comments