SharingClient
TheSharingClient class provides methods to explore and discover shared data from a Delta Sharing server.
Constructor
Path to the profile file, file-like object, or
DeltaSharingProfile instance.Supported formats:- Local file path:
/path/to/profile.share - FSSPEC URL:
s3://bucket/profile.share - DBFS path:
/dbfs/path/to/profile.share - File-like object (BinaryIO or TextIO)
DeltaSharingProfileinstance
Methods
list_shares()
List all shares accessible to you in the Delta Sharing server.Share objects.
Example:
list_schemas()
List all schemas in a specific share.The share object to list schemas from.
Schema objects.
Example:
list_tables()
List all tables in a specific schema.The schema object to list tables from.
Table objects.
Example:
list_all_tables()
List all tables accessible to you across all shares and schemas.Table objects.
Example:
This method may fallback to iterating through shares and schemas if the server doesn’t support the all-tables API.
Data Loading Functions
load_as_pandas()
Load a shared table as a pandas DataFrame.Table URL in the format
<profile-path>#<share>.<schema>.<table>Load only the specified number of rows. Useful for sampling large tables. Must be non-negative.
Load the table snapshot at a specific version. Must be non-negative. Cannot be used with
timestamp.Load the table snapshot at or after this timestamp. Format:
YYYY-MM-DDThh:mm:ssZ. Cannot be used with version.JSON string containing predicate hints for filtering. See Advanced Usage for details.
Whether to use Delta format or Parquet format. If not specified, determined from table metadata.
Whether to convert files to pandas one batch at a time to reduce memory usage.
load_as_spark()
Load a shared table as an Apache Spark DataFrame.Table URL. Format depends on
delta_sharing_profile:- With profile parameter:
<share>.<schema>.<table> - Without profile parameter:
<profile-path>#<share>.<schema>.<table>
Load the table snapshot at a specific version. Cannot be used with
timestamp.Load the table snapshot at this timestamp. Format:
YYYY-MM-DDThh:mm:ssZ. Cannot be used with version.Profile object for authentication. If provided, credentials are passed as Spark options instead of reading from a file.
load_table_changes_as_pandas()
Load table changes (Change Data Feed) as a pandas DataFrame.Table URL in the format
<profile-path>#<share>.<schema>.<table>Starting version (inclusive). Either this or
starting_timestamp is required.Ending version (inclusive). If not provided, uses the latest version.
Starting timestamp. Format:
YYYY-MM-DDThh:mm:ssZ. Either this or starting_version is required.Ending timestamp (inclusive). Format:
YYYY-MM-DDThh:mm:ssZ. If not provided, uses the latest version.Whether to use Delta format. Defaults to Parquet format if not specified.
Convert files to pandas one batch at a time to reduce memory usage.
- All original table columns
_change_type:insert,update_preimage,update_postimage, ordelete_commit_version: Version number of the change_commit_timestamp: Timestamp of the change
load_table_changes_as_spark()
Load table changes (Change Data Feed) as a Spark DataFrame.Table URL. Format depends on
delta_sharing_profile:- With profile parameter:
<share>.<schema>.<table> - Without profile parameter:
<profile-path>#<share>.<schema>.<table>
Starting version (inclusive). Either this or
starting_timestamp is required.Ending version (inclusive). Uses latest if not provided.
Starting timestamp. Format:
YYYY-MM-DDThh:mm:ssZ.Ending timestamp. Format:
YYYY-MM-DDThh:mm:ssZ.Profile object for authentication.
Metadata Functions
get_table_version()
Get the current or historical version of a shared table.Table URL in the format
<profile-path>#<share>.<schema>.<table>Get the version at or after this timestamp. Format:
YYYY-MM-DDThh:mm:ssZ. Returns latest version if not specified.get_table_metadata()
Get the metadata of a shared table.Table URL in the format
<profile-path>#<share>.<schema>.<table>Whether to request Delta format metadata.
Metadata object containing:
id: Table UUIDname: Table namedescription: Table descriptionformat: Format provider (e.g., “parquet”)schema_string: JSON string representation of the schemaconfiguration: Table configurationpartition_columns: List of partition column names
get_table_protocol()
Get the protocol version of a shared table.Table URL in the format
<profile-path>#<share>.<schema>.<table>Whether to request Delta format protocol.
Protocol object containing:
min_reader_version: Minimum reader version requiredmin_writer_version: Minimum writer version required (optional)reader_features: List of reader features (optional)