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

or with uv:

uv 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")

# Projects: create and list projects
dp.projects.create_project("analytics", description="Analytics workspace")
projects = dp.projects.list_projects()

# Bronze: create a resource in a project and upload (.csv, .parquet, .json, .xlsx)
dp.bronze.create_resource("raw_sales", project_id=projects[0].id)
dp.bronze.upload(projects[0].id, file_path="sales.csv")
raw = dp.bronze.download(projects[0].id)

# Silver: create resource inside a project and upload LazyFrame with lineage
dp.silver.create_resource("clean_sales", project_id=projects[0].id)
dp.silver.upload(2, lf, from_resource_id=1)
lf = dp.silver.download(2)

# Gold: aggregated LazyFrames with multi-source lineage
dp.gold.create_resource("sales_summary", project_id=projects[0].id)
dp.gold.upload(3, lf, from_resource_ids=[2])

The client can be used as a context manager:

with DataPebbles("http://localhost:8000") as dp:
    resources = dp.bronze.list_resources()

Layers

Bronze

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

Method Description
create_resource(name) Create a new resource
list_resources() List all resources
get_resource(resource_id) Get resource metadata
update_resource(resource_id, name) Rename a resource
delete_resource(resource_id) Delete a resource
list_versions(resource_id) List all versions
upload(resource_id, *, file_path=None, data=None, file_name="upload") Upload a file by path or raw bytes
download(resource_id, *, version=None) Download raw bytes (defaults to latest version)
activate_version(resource_id, version) Set a version as active
delete_version(resource_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_resource(name) Create a new resource
list_resources() List all resources
get_resource(resource_id) Get resource metadata
update_resource(resource_id, name) Rename a resource
delete_resource(resource_id) Delete a resource
list_versions(resource_id) List all versions with lineage
upload(resource_id, data, *, from_resource_id) Upload a DataFrame/LazyFrame with bronze lineage
download(resource_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_resource(name) Create a new resource
list_resources() List all resources
get_resource(resource_id) Get resource metadata
update_resource(resource_id, name) Rename a resource
delete_resource(resource_id) Delete a resource
list_versions(resource_id) List all versions with lineage
upload(resource_id, data, *, from_resource_ids) Upload a DataFrame/LazyFrame with silver lineage
download(resource_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 resource 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.3.tar.gz (20.3 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.3-py3-none-any.whl (74.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: data_pebbles-0.0.3.tar.gz
  • Upload date:
  • Size: 20.3 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.3.tar.gz
Algorithm Hash digest
SHA256 c2dd00ee06acb8ff43e973f171bb44f076a27fd217ada3124563e4cbf249f0ad
MD5 36f89f38eb8f7978565a85560fde2354
BLAKE2b-256 afbecfc4bd8dd2e09792d706f316c492b88ff2af008aff7c409cddbdbe086b33

See more details on using hashes here.

Provenance

The following attestation bundles were made for data_pebbles-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: data_pebbles-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 74.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62f68409b68038eee0819cceb7833b9c563e053793e13c9d7fd189019e48171d
MD5 3c4996e95d3aa8acf04f7adfaaf8335d
BLAKE2b-256 1032382328ac9ab1b6bfbbb0641ae69f0928ea22d40f587ec2b92f7dd5a4c3e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for data_pebbles-0.0.3-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