Simplify datafile metadata resolution order
Summary
This release simplifies the Datafile
class internals and clarifies its metadata resolution order. Stored metadata will now be used in preference to instantiation metadata unless the hypothetical
parameter is True
, allowing the removal of some confusing internal logic from the class.
Contents (#433)
Enhancements
- If
hypothetical
is notTrue
when re-instantiating existing datafiles, always use their stored metadata (from the cloud object or local metadata file) - Store cloud metadata on
Datafile
instances without theoctue__
namespace prefix in its keys - Make
Datafile
metadata update methods public so they can be called easily by users - Make it optional whether to include the SDK version in the output of
Datafile.metadata
- Return
None
fromGoogleCloudStorageClient.get_metadata
if bucket not found instead of raising an error
Fixes
- Allow instantiation of a cloud datafile with a non-existent or inaccessible cloud path (defer raising errors until attempting to access it)
Refactoring
- Simplify
Datafile
internals by removing the "initialisation parameters" concept - Rename
Datafile._get_local_metadata
toDatafile._use_local_metadata
- Align
Datafile._use_cloud_metadata
andDatafile._use_local_metadata
methods - Factor out setting
Datafile
instance metadata from stored metadata into_set_metadata
method