Skip to main content

deltastream-connector

A Python client library for DeltaStream - a SQL streaming processing engine based on Apache Flink.

Features

  • Asynchronous API client for DeltaStream
  • Support for SQL statements execution
  • Streaming result sets
  • File attachments for SQL queries (e.g., JAR files for UDFs)
  • API Token authentication
  • Python 3.11+ support

Installation

pip install deltastream-connector

Quick Start

import asyncio
from deltastream.api.conn import APIConnection

# Initialize connection with API token
auth_token = os.getenv("DELTASTREAM_AUTH_TOKEN")

if not auth_token:
    raise ValueError("Environment variable 'DELTASTREAM_AUTH_TOKEN' is not set")

# Use the token to construct the DSN and create the connection
dsn = f"https://:{auth_token}@api.deltastream.io/v2"
conn = APIConnection.from_dsn(dsn)

async def main():
    # Execute SQL queries
    rows = await conn.query("SELECT 1;")
    
    # Process results asynchronously
    async for row in rows:
        print(row)

if __name__ == '__main__':
    asyncio.run(main())

File Attachments

The connector provides convenient helper functions to attach files (like JAR files for UDFs) to SQL queries without manually creating blob objects.

Simple File Attachment

import asyncio
from deltastream.api.conn import APIConnection

async def main():
    conn = APIConnection.from_dsn("https://:{token}@api.deltastream.io/v2")
    
    # Create a function source with a JAR file attachment
    await conn.exec_with_files(
        "CREATE FUNCTION_SOURCE \"my_udf\" WITH ('file' = 'my_function.jar', 'description' = 'My custom UDF');",
        ["/path/to/my_function.jar"]
    )
    
    # Query function sources and get results
    rows = await conn.query_with_files("SHOW FUNCTION_SOURCES;")
    async for row in rows:
        print(f"Function: {row[0]}, Status: {row[1]}")

if __name__ == '__main__':
    asyncio.run(main())

Advanced File Attachment Configuration

# Custom file names and content types
await conn.exec_with_files(
    "CREATE FUNCTION_SOURCE \"advanced_udf\" WITH ('file' = 'custom_name.jar');",
    [{
        "path": "/path/to/actual_file.jar",
        "name": "custom_name.jar",
        "content_type": "application/java-archive"
    }]
)

# Multiple files
await conn.exec_with_files(
    "CREATE FUNCTION_SOURCE \"multi_file_udf\" WITH ('file' = 'main.jar', 'lib' = 'dependency.jar');",
    [
        "/path/to/main.jar",
        {"path": "/path/to/lib.jar", "name": "dependency.jar"}
    ]
)

Authentication

The connector uses API token authentication. You can obtain an API token from the DeltaStream platform by running CREATE API_TOKEN api_token_name; using the console.

Support

For support, please contact support@deltastream.com or open an issue on our GitHub repository.

Metadata

Release files for deltastream-connector 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deltastream-connector 0.3.1
File Size Uploaded Provenance Actions
deltastream_connector-0.3.1.tar.gz 66.5 kB With provenance Details for deltastream_connector-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deltastream-connector 0.3.1
File Interpreter ABI Platform Actions
deltastream_connector-0.3.1-py3-none-any.whl Python 3 none any Details for deltastream_connector-0.3.1-py3-none-any.whl

Total release size: 180.7 kB

Release files / deltastream_connector-0.3.1.tar.gz

Download URL deltastream_connector-0.3.1.tar.gz
Size 66.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e9f9f9c0992387009667bd0965bd2dbf7f222368576d399f1b326cc6f5e0211a
BLAKE2b-256 checksum
How to use checksums
58425c817308715b59e5c7d7a28efc6c52654e96e9f50c20e4b00d30eafad557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Oct 30, 2025.

Transparency log

Release files / deltastream_connector-0.3.1-py3-none-any.whl

Download URL deltastream_connector-0.3.1-py3-none-any.whl
Size 114.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2eba0b22ab4ddaba0c446b678275a9f6bf4facc88555899afd5fff6d32dd1ede
BLAKE2b-256 checksum
How to use checksums
1887d255dc1db919c518eb747b0288bfe3898b4c561f780372809d86b1ceb526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Oct 30, 2025.

Transparency log

Security for deltastream-connector 0.3.1

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.

Select from 2 files

Attestation for deltastream_connector-0.3.1.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 Oct 30, 2025.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page