Profile File Paths
The Delta Sharing Python Connector supports multiple ways to specify profile file paths, enabling flexible deployment scenarios.FSSPEC Support
Profile paths forSharingClient and load_as_pandas support any URL format recognized by FSSPEC (Filesystem Spec).
What is FSSPEC?
What is FSSPEC?
FSSPEC is a Python library that provides a unified interface to access different filesystems. It allows you to use the same code to work with local files, cloud storage (S3, Azure, GCS), HTTP endpoints, and more.
Local File System
Amazon S3
Install S3 support with:
pip install delta-sharing[s3]Azure Blob Storage
Install Azure Blob Storage support with:
pip install delta-sharing[abfs]Google Cloud Storage
Install GCS support with:
pip install delta-sharing[gcs]DBFS Support
When using Databricks File System (DBFS), you can access profile files using the/dbfs/ prefix to treat them as local files:
Spark Profile Paths
Forload_as_spark and load_table_changes_as_spark, profile paths must be compatible with Hadoop FileSystem:
Use
s3a:// (not s3://) for S3 paths with Spark, and dbfs:/ (not /dbfs/) for DBFS paths.JSON Predicate Hints
Predicate hints allow you to push down filters to the Delta Sharing server, reducing the amount of data transferred and improving query performance.Predicate Format
Predicates are specified as JSON strings following the Delta Sharing Protocol specification.Basic Predicates
Equality
Less Than / Greater Than
IS NULL
Composite Predicates
AND
OR
Date and Timestamp Predicates
Supported Operators
Comparison Operators
Comparison Operators
equal: Equality comparisonlessThan: Less thanlessThanOrEqual: Less than or equalgreaterThan: Greater thangreaterThanOrEqual: Greater than or equal
Logical Operators
Logical Operators
and: Logical ANDor: Logical ORnot: Logical NOT
Null Operators
Null Operators
isNull: Check if value is NULLisNotNull: Check if value is NOT NULL
Supported Value Types
bool: Boolean valuesint: Integer valueslong: Long integer valuesfloat: Floating-point valuesdouble: Double-precision floating-point valuesstring: String valuesdate: Date values (format: YYYY-MM-DD)timestamp: Timestamp values (format: YYYY-MM-DDThh:mm:ss[.SSS]Z)
Memory Optimization with convert_in_batches
For large tables, theconvert_in_batches parameter can significantly reduce memory consumption by converting Parquet files to pandas DataFrames one batch at a time instead of one file at a time.
When to Use
Useconvert_in_batches=True when:
- Working with large tables that don’t fit comfortably in memory
- Individual Parquet files are large
- You want to reduce peak memory usage
- Query performance is less critical than memory usage
Trade-offs
Advantages:- Lower peak memory usage
- Prevents out-of-memory errors on constrained systems
- Better for parquet format queries
- May take longer to complete
- May download more data due to batch overhead
- Slightly more CPU overhead for batch processing
Example Usage
With Change Data Feed
Delta Format vs Parquet Format
Delta Sharing supports two data formats for transferring table data: Delta format and Parquet format.Format Comparison
Using Delta Format
Automatic Format Selection
Ifuse_delta_format is not specified, the connector automatically selects the best format based on table metadata:
Format for Change Data Feed
For Change Data Feed queries, Delta format is recommended:When using Delta format for CDF, the connector properly handles metadata changes by replaying the Delta log, ensuring data consistency across versions.
Working with DeltaSharingProfile Objects
Instead of using profile file paths, you can create and useDeltaSharingProfile objects directly for more control over authentication.