An OpenAPI client for the DeltaStream API
Project description
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deltastream_connector-0.3.1.tar.gz.
File metadata
- Download URL: deltastream_connector-0.3.1.tar.gz
- Upload date:
- Size: 66.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9f9f9c0992387009667bd0965bd2dbf7f222368576d399f1b326cc6f5e0211a
|
|
| MD5 |
0fd9036a3117c3206a767a3dbf7f3f67
|
|
| BLAKE2b-256 |
58425c817308715b59e5c7d7a28efc6c52654e96e9f50c20e4b00d30eafad557
|
Provenance
The following attestation bundles were made for deltastream_connector-0.3.1.tar.gz:
Publisher:
release.yml on deltastreaminc/deltastream-connector-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deltastream_connector-0.3.1.tar.gz -
Subject digest:
e9f9f9c0992387009667bd0965bd2dbf7f222368576d399f1b326cc6f5e0211a - Sigstore transparency entry: 656060701
- Sigstore integration time:
-
Permalink:
deltastreaminc/deltastream-connector-python@9347851bf4b978cabf0030c3a52c1702f33df442 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deltastreaminc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9347851bf4b978cabf0030c3a52c1702f33df442 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file deltastream_connector-0.3.1-py3-none-any.whl.
File metadata
- Download URL: deltastream_connector-0.3.1-py3-none-any.whl
- Upload date:
- Size: 114.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eba0b22ab4ddaba0c446b678275a9f6bf4facc88555899afd5fff6d32dd1ede
|
|
| MD5 |
4bd7d9853333897d8c55d845450fb9f0
|
|
| BLAKE2b-256 |
1887d255dc1db919c518eb747b0288bfe3898b4c561f780372809d86b1ceb526
|
Provenance
The following attestation bundles were made for deltastream_connector-0.3.1-py3-none-any.whl:
Publisher:
release.yml on deltastreaminc/deltastream-connector-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deltastream_connector-0.3.1-py3-none-any.whl -
Subject digest:
2eba0b22ab4ddaba0c446b678275a9f6bf4facc88555899afd5fff6d32dd1ede - Sigstore transparency entry: 656060772
- Sigstore integration time:
-
Permalink:
deltastreaminc/deltastream-connector-python@9347851bf4b978cabf0030c3a52c1702f33df442 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deltastreaminc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9347851bf4b978cabf0030c3a52c1702f33df442 -
Trigger Event:
workflow_dispatch
-
Statement type: