dbx-marker
Easily manage incremental progress using watermarks in your Databricks data pipelines.
Overview
dbx-marker is a Python library that helps you manage watermarks in your Databricks data pipelines using Delta tables.
It provides a simple interface to track and manage pipeline progress, making it easier to implement incremental processing and resume operations.
Features
- Simple API for managing pipeline watermarks
- Persistent storage using Delta tables
- Thread-safe operations
- Comprehensive error handling
- Built for Databricks environments
Installation
Install using pip:
pip install dbx-marker
Quick Start
from dbx_marker import DbxMarker
from pyspark.sql import SparkSession
# Initialize SparkSession
spark = SparkSession.builder.getOrCreate()
# Create a marker manager
manager = DbxMarker(
delta_table_path="/path/to/markers",
spark=spark
)
# Update a marker (will upsert if it doesn't exist)
manager.update_marker("my_pipeline", "2024-01-21")
# Get the current marker
current_marker = manager.get_marker("my_pipeline")
# Delete a marker when needed
manager.delete_marker("my_pipeline")
Usage
Initialization
Create a DbxMarkerManager instance by specifying the Delta table path where markers will be stored:
from dbx_marker import DbxMarker
from pyspark.sql import SparkSession
# Initialize SparkSession
spark = SparkSession.builder.getOrCreate()
manager = DbxMarker(
delta_table_path="/path/to/markers",
spark=spark # Optional: will create new session if not provided
)
Managing Markers
Update a Marker
manager.update_marker("pipeline_name", "marker_value")
Get Current Marker
current_value = manager.get_marker("pipeline_name")
Delete a Marker
manager.delete_marker("pipeline_name")
Error Handling
The library provides specific exceptions for different scenarios:
MarkerExistsError: When trying to create a duplicate markerMarkerNotFoundError: When a requested marker doesn't existMarkerUpdateError: When marker update failsMarkerDeleteError: When marker deletion fails
Requirements
- Python >= 3.13
- PySpark >= 3.5.4
- Delta-Spark >= 3.3.0
- Loguru >= 0.7.3
Development
- Clone the repository
- Install development dependencies:
pdm install -G dev
- Run tests:
pdm run test
- Run all checks:
pdm run all-checks
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for dbx-marker 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dbx_marker-1.0.6.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbx_marker-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / dbx_marker-1.0.6.tar.gz
| Download URL | dbx_marker-1.0.6.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cc876b9af6a44e483ce40fde1aa602846637120153f8984553ab5758c2130bc
|
|
BLAKE2b-256 checksum How to use checksums |
499ec36b10bfa9cdc6f4221a8cf0d1b9b05eda74b2ef36b654012fd2bfb36974
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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 Jan 22, 2025.
Transparency logRelease files / dbx_marker-1.0.6-py3-none-any.whl
| Download URL | dbx_marker-1.0.6-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4221485845c24a3ef4181421949426207b9b496919e213a6b53b3f590d0e7bbe
|
|
BLAKE2b-256 checksum How to use checksums |
b78dc74d89863cdb493a25ae7e4e7779677bde5b5c3408ada54990b53b039cf7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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 Jan 22, 2025.
Transparency log