Skip to main content

Profile File Paths

The Delta Sharing Python Connector supports multiple ways to specify profile file paths, enabling flexible deployment scenarios.

FSSPEC Support

Profile paths for SharingClient and load_as_pandas support any URL format recognized by FSSPEC (Filesystem Spec).
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:
The /dbfs/ prefix works for SharingClient and load_as_pandas, but load_as_spark requires Hadoop FileSystem-compatible paths (e.g., dbfs:/mnt/profiles/production.share).

Spark Profile Paths

For load_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

  • equal: Equality comparison
  • lessThan: Less than
  • lessThanOrEqual: Less than or equal
  • greaterThan: Greater than
  • greaterThanOrEqual: Greater than or equal
  • and: Logical AND
  • or: Logical OR
  • not: Logical NOT
  • isNull: Check if value is NULL
  • isNotNull: Check if value is NOT NULL

Supported Value Types

  • bool: Boolean values
  • int: Integer values
  • long: Long integer values
  • float: Floating-point values
  • double: Double-precision floating-point values
  • string: String values
  • date: Date values (format: YYYY-MM-DD)
  • timestamp: Timestamp values (format: YYYY-MM-DDThh:mm:ss[.SSS]Z)
Predicate hints are optimization hints only. The server may return more data than specified by the predicate, so additional client-side filtering may be necessary for correctness.

Memory Optimization with convert_in_batches

For large tables, the convert_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

Use convert_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
Disadvantages:
  • 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

If use_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 use DeltaSharingProfile objects directly for more control over authentication.

Reading from File

Profile Authentication Types

The connector supports multiple authentication types:

Bearer Token (Version 1)

Bearer Token (Version 2)

OAuth Client Credentials

Basic Authentication

Programmatic Profile Creation


Performance Best Practices

1. Use Delta Format When Possible

2. Apply Predicate Hints

3. Use Limits for Exploration

4. Enable Batch Conversion for Large Tables

5. Cache Profile Files Locally

6. Reuse SharingClient Instances


Error Handling

Common Errors and Solutions

Validating Profile Files


Complete Advanced Example