dbt-spark-livy-iceberg
The dbt-spark-livy-iceberg adapter lets you use dbt with Apache Spark on Cloudera Data Platform through the Livy interface. It is based on the dbt-spark project and the Cloudera dbt-spark-livy adapter, extended with:
- Full Apache Iceberg support —
file_format='iceberg'for tables, incremental models (append,merge,insert_overwrite), seeds, and snapshots. incremental_predicatesfor merges — pruning predicates are now passed intoMERGE INTO ... ON, which the base adapter dropped.- Iceberg table properties — a
tblpropertiesconfig for setting Iceberg options likeformat-versionandwrite.merge.mode. - Dynamic Spark session configuration — a per-model
spark_session_configconfig that issuesSET key=valuestatements before the model runs.
The internal adapter type is still spark_livy, so existing profiles (method: livy) keep working. Only the pip distribution name changed.
Getting started
- Install dbt
- Read the introduction and viewpoint
Requirements
- Python >= 3.8
- dbt-core ~= 1.3.0
- pyspark, sqlparams, requests_kerberos, requests-toolbelt, python-decouple
Installing
pip install dbt-spark-livy-iceberg
Profile setup
demo_project:
target: dev
outputs:
dev:
type: spark_livy
method: livy
schema: my_db
host: https://spark-livy-gateway.my.org.com/dbt-spark/cdp-proxy-api/livy_for_spark3/
user: my_user
password: my_pass
# Optional: Spark conf applied once at Livy session creation.
# Use this for catalog wiring (e.g. Iceberg catalog + extensions).
livy_session_parameters:
spark.sql.extensions: "org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions"
spark.sql.catalog.spark_catalog: "org.apache.iceberg.spark.SparkSessionCatalog"
spark.sql.catalog.spark_catalog.type: "hive"
Iceberg models
Incremental merge
{{ config(
materialized='incremental',
file_format='iceberg',
incremental_strategy='merge',
unique_key='id',
incremental_predicates=[
"DBT_INTERNAL_DEST.event_date >= current_date - interval 7 days"
],
tblproperties={
'format-version': '2',
'write.merge.mode': 'merge-on-read'
}
) }}
select id, event_date, payload
from {{ ref('source_events') }}
{% if is_incremental() %}
where event_date >= current_date - interval 7 days
{% endif %}
incremental_strategysupportsappend,merge, andinsert_overwritefor Iceberg.incremental_predicatesare appended to the mergeONclause to enable partition pruning.on_schema_change: sync_all_columnsis supported for Iceberg (including dropping columns).
Dynamic Spark session configuration
Set Spark conf per model with spark_session_config. This issues SET key=value before the model builds.
{{ config(
materialized='incremental',
file_format='iceberg',
incremental_strategy='insert_overwrite',
partition_by=['event_date'],
spark_session_config={
'spark.sql.shuffle.partitions': '400',
'spark.sql.sources.partitionOverwriteMode': 'dynamic'
}
) }}
select ...
You can also set project-wide defaults in dbt_project.yml:
models:
my_project:
+spark_session_config:
spark.sql.shuffle.partitions: '200'
+tblproperties:
write.merge.mode: 'merge-on-read'
Note: The Livy connection reuses a single shared SQL session for the whole dbt run, so
SETvalues persist across models. Set the properties each model needs (or a project-level default) rather than assuming they reset between models.
Caveats
- While using livy, in the Livy UI if you notice sessions change state to dead from starting instead of idle, make sure there is a proper mapping for the user in the IDBroker mapping section.
- Actions > Manage Access > IDBroker Mappings. Reference
- Also make sure the workload password is set either through UI or CLI. Reference
- Iceberg catalog/extension wiring must be provided via Spark conf (
livy_session_parametersin the profile, orspark_session_configper model). - Python models currently write with the Delta writer; Iceberg support here targets SQL models.
Supported features
See the original adapter documentation: https://github.com/dbt-labs/dbt-spark and https://docs.getdbt.com/reference/warehouse-profiles/spark-profile
Metadata
Release files for dbt-spark-livy-iceberg 1.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dbt_spark_livy_iceberg-1.3.4.tar.gz | 44.3 kB | With provenance | Details for dbt_spark_livy_iceberg-1.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dbt_spark_livy_iceberg-1.3.4-py3-none-any.whl | Python 3 | none | any | Details for dbt_spark_livy_iceberg-1.3.4-py3-none-any.whl |
Total release size: 97.8 kB
Release files / dbt_spark_livy_iceberg-1.3.4.tar.gz
| Download URL | dbt_spark_livy_iceberg-1.3.4.tar.gz |
|---|---|
| Size | 44.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
818db7970020a865e991448107b661caf828585a026257b95c24d60ce5af329d
|
|
BLAKE2b-256 checksum How to use checksums |
5ef8f23e648f86b08e07f0b0bca2f68e2cb613534768a6b499a3678c47297cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logRelease files / dbt_spark_livy_iceberg-1.3.4-py3-none-any.whl
| Download URL | dbt_spark_livy_iceberg-1.3.4-py3-none-any.whl |
|---|---|
| Size | 53.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b82f04c9c152e0dfb4d93b29b2257f197b697f0ec0265567d26a91ffe2a7ae1e
|
|
BLAKE2b-256 checksum How to use checksums |
f1687c33f77212d58e2eb608e6c007e9fded2a7cf0446f71158493cc9cc26a74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logSecurity for dbt-spark-livy-iceberg 1.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dbt_spark_livy_iceberg-1.3.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.