delta_engine.databricks

Public Databricks entry points.

The implementation lives in delta_engine.adapters.databricks. This module keeps the user-facing Databricks import path short while preserving lazy backend imports (PySpark, databricks-sql-connector) for code that only declares schemas or inspects result types.

Functions

build_spark_engine(...)

Create an engine that syncs through an active Spark session.

to_spark_schema(→ pyspark.sql.types.StructType)

Convert a table declaration to a native PySpark StructType.

build_sql_engine(→ delta_engine.application.engine.Engine)

Create an engine that syncs through a Databricks SQL warehouse connection.

build_reader(...)

Create a read-only catalog state reader for a Databricks SQL warehouse.

configure_logging(→ None)

Install the package's colored logging handler.

Module Contents

build_spark_engine(spark: pyspark.sql.SparkSession) delta_engine.application.engine.Engine

Create an engine that syncs through an active Spark session.

to_spark_schema(table: delta_engine.application.ports.DesiredTableSource) pyspark.sql.types.StructType

Convert a table declaration to a native PySpark StructType.

Preserves column order, authored name spelling, data type, and nullability. Comments and tags remain catalog metadata and are not copied into Spark field metadata. Array elements and map values are nullable because Delta Engine declarations do not model their nullability separately.

build_sql_engine(connection: databricks.sql.client.Connection) delta_engine.application.engine.Engine

Create an engine that syncs through a Databricks SQL warehouse connection.

PySpark-free: pass a connection from databricks.sql.connect(...) (the delta-engine[sql] extra) and syncs run from any plain Python environment. Unity Catalog only.

build_reader(connection: databricks.sql.client.Connection) delta_engine.application.ports.CatalogStateReader

Create a read-only catalog state reader for a Databricks SQL warehouse.

The caller opens and owns the connection, exactly as for build_sql_engine. The reader fetches one table’s observed state and executes no DDL.

configure_logging(level: int = logging.INFO, stream: TextIO | None = None) None

Install the package’s colored logging handler.