Skip to content

Python Database driver for DeltaStream Inc (PEP 249)

License

Notifications You must be signed in to change notification settings

deltastreaminc/deltastream-connector-python

Repository files navigation

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
  • 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())

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 [email protected] or open an issue on our GitHub repository.

About

Python Database driver for DeltaStream Inc (PEP 249)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages