Skip to main content

A Python library for interacting with the open source data catalog Data Pebbles.

Project description

Data Pebbles SDK

Python SDK for the Data Pebbles platform — manage data across bronze, silver, and gold layers with built-in lineage tracking.

Installation

pip install data-pebbles

Requires Python 3.13+. Dependencies: polars, httpx, mlflow.

Quick Start

from data_pebbles import DataPebbles

dp = DataPebbles("http://localhost:8000", token="your-token")

# Bronze: upload raw files (.csv, .parquet, .json, .xlsx)
dp.bronze.create_source("raw_sales")
dp.bronze.upload(1, file_path="sales.csv")
raw = dp.bronze.download(1)

# Silver: cleaned LazyFrames with lineage
dp.silver.create_source("clean_sales")
dp.silver.upload(2, lf, from_source_id=1)
lf = dp.silver.download(2)

# Gold: aggregated LazyFrames with multi-source lineage
dp.gold.create_source("sales_summary")
dp.gold.upload(3, lf, from_source_ids=[2])

The client can be used as a context manager:

with DataPebbles("http://localhost:8000") as dp:
    sources = dp.bronze.list_sources()

Layers

Bronze

Stores raw, unprocessed files. Only .csv, .parquet, .json, and .xlsx files are accepted.

Method Description
create_source(name) Create a new source
list_sources() List all sources
get_source(source_id) Get source metadata
update_source(source_id, name) Rename a source
delete_source(source_id) Delete a source
list_versions(source_id) List all versions
upload(source_id, *, file_path=None, data=None, file_name="upload") Upload a file by path or raw bytes
download(source_id, *, version=None) Download raw bytes (defaults to latest version)
activate_version(source_id, version) Set a version as active
delete_version(source_id, version) Delete a version

Silver

Stores cleaned, structured data as Parquet. Works with Polars DataFrames/LazyFrames and tracks lineage back to bronze.

Method Description
create_source(name) Create a new source
list_sources() List all sources
get_source(source_id) Get source metadata
update_source(source_id, name) Rename a source
delete_source(source_id) Delete a source
list_versions(source_id) List all versions with lineage
upload(source_id, data, *, from_source_id) Upload a DataFrame/LazyFrame with bronze lineage
download(source_id, *, version=None) Download as a Polars LazyFrame

Gold

Stores aggregated, business-ready data as Parquet. Supports multi-source lineage from silver.

Method Description
create_source(name) Create a new source
list_sources() List all sources
get_source(source_id) Get source metadata
update_source(source_id, name) Rename a source
delete_source(source_id) Delete a source
list_versions(source_id) List all versions with lineage
upload(source_id, data, *, from_source_ids) Upload a DataFrame/LazyFrame with silver lineage
download(source_id, *, version=None) Download as a Polars LazyFrame

Transform Decorators

Automate downloading, transforming, and uploading data between layers with lineage tracking.

silver_transform

Transforms bronze → silver. The decorator auto-parses bronze data into a LazyFrame based on the original file extension. The decorated function receives a LazyFrame and returns a LazyFrame.

@dp.silver_transform(target_id=2, from_bronze_id=1)
def clean(lf: pl.LazyFrame) -> pl.LazyFrame:
    return lf.filter(pl.col("amount") > 0)

clean()            # uses latest bronze version
clean(version=5)   # uses a specific bronze version

For CSV files with a non-standard delimiter, use csv_separator:

@dp.silver_transform(target_id=2, from_bronze_id=1, csv_separator=";")
def clean_eu(lf: pl.LazyFrame) -> pl.LazyFrame:
    return lf.filter(pl.col("amount") > 0)

gold_transform

Transforms silver → gold. The decorated function receives a dict mapping silver source IDs to their LazyFrames and returns a LazyFrame.

@dp.gold_transform(target_id=3, from_silver_ids=[1, 2])
def aggregate(sources: dict[int, pl.LazyFrame]) -> pl.LazyFrame:
    return (
        pl.concat(sources.values())
        .group_by("category")
        .agg(pl.sum("amount"))
    )

aggregate()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_pebbles-0.0.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

data_pebbles-0.0.1-py3-none-any.whl (60.1 kB view details)

Uploaded Python 3

File details

Details for the file data_pebbles-0.0.1.tar.gz.

File metadata

  • Download URL: data_pebbles-0.0.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for data_pebbles-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1ceb73de6f9ce53c340b132b5723a74db57a125fc9d11caa90ce7cc9ff2949ec
MD5 a40d8d1be9b32cb62b42e7638c3a3901
BLAKE2b-256 dbdae7127bab6fba655e90ca89419fde4829c89aafee38d2a0c933f1562be23e

See more details on using hashes here.

Provenance

The following attestation bundles were made for data_pebbles-0.0.1.tar.gz:

Publisher: publish.yml on LeonDavidZipp/data-pebbles-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file data_pebbles-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: data_pebbles-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 60.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for data_pebbles-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76471fc6e4bfc8cf935b83fcfb641e8ca99ad15a1a2b0efeee034c8e9f4176e8
MD5 6bc55161180d03ecbcfd00d50585c9bd
BLAKE2b-256 059bf25b90f1197c07c519fa6f60b541c9b40f05c61d41de777b459792ebb51b

See more details on using hashes here.

Provenance

The following attestation bundles were made for data_pebbles-0.0.1-py3-none-any.whl:

Publisher: publish.yml on LeonDavidZipp/data-pebbles-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page