Skip to main content

The feldera python client

Project description

Feldera Python SDK

The feldera Python package is the Python client for the Feldera HTTP API.

The Python SDK documentation is available at: https://docs.feldera.com/python

Getting started

Installation

uv pip install feldera

Example usage

The Python client interacts with the API server of the Feldera instance.

# File: example.py
from feldera import FelderaClient, PipelineBuilder, Pipeline

# Instantiate client
client = FelderaClient()  # Default: http://localhost:8080 without authentication
# client = FelderaClient(url="https://localhost:8080", api_key="apikey:...", requests_verify="/path/to/tls.crt")

# (Re)create pipeline
name = "example"
sql = """
CREATE TABLE t1 (i1 INT) WITH ('materialized' = 'true');
CREATE MATERIALIZED VIEW v1 AS SELECT * FROM t1;
"""
print("(Re)creating pipeline...")
pipeline = PipelineBuilder(client, name, sql).create_or_replace()
pipeline.start()
print(f"Pipeline status: {pipeline.status()}")
pipeline.pause()
print(f"Pipeline status: {pipeline.status()}")
pipeline.stop(force=True)

# Find existing pipeline
pipeline = Pipeline.get(name, client)
pipeline.start()
print(f"Pipeline status: {pipeline.status()}")
pipeline.stop(force=True)
pipeline.clear_storage()

Run using:

uv run python example.py

Environment variables

Some default parameter values in the Python SDK can be overridden via environment variables.

Environment variables for FelderaClient(...)

export FELDERA_HOST="https://localhost:8080"  # Overrides default for `url`
export FELDERA_API_KEY="apikey:..."  # Overrides default for `api_key`

# The following together override default for `requests_verify`
# export FELDERA_TLS_INSECURE="false"  # If set to "1", "true" or "yes" (all case-insensitive), disables TLS certificate verification
# export FELDERA_HTTPS_TLS_CERT="/path/to/tls.crt"  # Custom TLS certificate

Environment variables for PipelineBuilder(...)

export FELDERA_RUNTIME_VERSION="..."  # Overrides default for `runtime_version`

Development

Development assumes you have cloned the Feldera code repository.

Installation

cd python
# Optional: create and activate virtual environment if you don't have one
uv venv
source .venv/bin/activate
# Install in editable mode
uv pip install -e .

Formatting

Formatting requires the ruff package: uv pip install ruff

cd python
ruff check
ruff format

Tests

Running the test requires the pytest package: uv pip install pytest

# All tests
cd python
uv run python -m pytest tests/

# Specific tests directory
uv run python -m pytest tests/platform/

# Specific test file
uv run python -m pytest tests/platform/test_pipeline_crud.py

# Specific test
uv run python -m pytest tests/platform/test_pipeline_crud.py::test_pipeline_post

# Tip: add argument -x at the end for it to fail fast
# Tip: add argument -s at the end to show stdout/stderr

For further information about the tests, please see tests/README.md.

Documentation

Building documentation requires the sphinx package: uv pip install sphinx

cd python/docs
sphinx-apidoc -o . ../feldera
make html
make clean  # Cleanup afterwards

Installation from GitHub

Latest main branch:

uv pip install git+https://github.com/feldera/feldera#subdirectory=python

Different branch (replace BRANCH_NAME):

uv pip install git+https://github.com/feldera/feldera@BRANCH_NAME#subdirectory=python

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

feldera-0.285.0.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

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

feldera-0.285.0-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file feldera-0.285.0.tar.gz.

File metadata

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

File hashes

Hashes for feldera-0.285.0.tar.gz
Algorithm Hash digest
SHA256 4bf34be75e27f475d612b4f9d852b5bcf5ce25640bea7201b44efb0891f74785
MD5 fea6decf86f770132af6b5200e690f66
BLAKE2b-256 dd0cb195771bbbab2e2d07f3ae09b85b990dd25a3803d5611cc57e4934d8fa2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for feldera-0.285.0.tar.gz:

Publisher: ci-post-release.yml on feldera/feldera

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

File details

Details for the file feldera-0.285.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for feldera-0.285.0-py3-none-any.whl
Algorithm Hash digest
SHA256 237e27877c90f3d1b03980e7e1a026bdb8bee71e9508ea97d6e0b4b1f8e4cabc
MD5 db91cb2cc655fcb413690b5d75a956d7
BLAKE2b-256 10a108d8180f17598144b0e11fba6404eb0be27e7b31b554c4fa31e6afe2cfef

See more details on using hashes here.

Provenance

The following attestation bundles were made for feldera-0.285.0-py3-none-any.whl:

Publisher: ci-post-release.yml on feldera/feldera

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