Skip to main content

SDK Overview

On this page, you can learn about:

  1. SDK Overview - Understand the SDK's functionality and purpose
  2. Installation - Quick setup of the SDK package
  3. Basic Usage - Learn how to create clients and basic configuration
  4. API Methods Directory - View all available organization and cluster management methods
  5. Detailed Documentation Links - Jump to complete API reference documentation

About SDK for EloqCloud

The Eloq SDK provides client libraries for managing Eloq cloud cluster services. We support both Python and TypeScript implementations, allowing you to programmatically control your cluster infrastructure with type-safe APIs.

You can use the Eloq SDK to manage your Eloq Organization and Cluster. The SDK abstracts the underlying API requests, authentication, and error handling, allowing you to focus on building applications that interact with Eloq resources.

Our SDK allows you to manage:

  • Organization Access organization details, user roles, and permissions

  • Cluster Create clusters,Get real-time cluster status and performance metrics

Eloq API:

Features

  • Type-safe API: Uses Pydantic dataclasses for structured input/output
  • Enum-based parameters: No need to guess parameter values - use enums for type safety
  • Automatic error handling: Comprehensive exception handling with clear error messages
  • Simple result objects: Operations return clear success/failure results
  • Auto-detection: Automatically retrieves organization and project IDs from user context

Installation

Using pip

pip install eloq-sdk

Requirements

  • Python 3.7 or higher
  • requests>=2.25.0
  • pydantic>=1.8.0

Quick Start

from eloq_sdk import EloqAPI

# Initialize client from environment variable
client = EloqAPI.from_environ()

# Get organization information
org_info = client.info()
print(f"Organization: {org_info.org_info.org_name}")

# List clusters
clusters = client.clusters()
print(f"Found {clusters.total} clusters")

Environment Setup

Set the ELOQ_API_KEY environment variable:

export ELOQ_API_KEY="your-api-key-here"

Authentication & Client Initialization

The SDK provides multiple ways to initialize the client:

1. From Environment Variable

from eloq_sdk import EloqAPI

client = EloqAPI.from_environ()

This reads the API key from the ELOQ_API_KEY environment variable.

2. From API Key

from eloq_sdk import EloqAPI

client = EloqAPI.from_key("your-api-key-here")

3. From API Key and Custom URL

from eloq_sdk import EloqAPI

client = EloqAPI.from_key_and_url(
"your-api-key-here",
"https://api-prod.eloqdata.com/api/v1/"
)

Documentation

Documentation for EloqAPI, including quick start

For detailed function documentation with input/output specifications, see Python SDK Documentation.

Error Handling

The SDK provides comprehensive error handling with specific exception types:

Exception Types

  • EloqAPIError: Base exception for all API errors
  • EloqAuthenticationError: Authentication failed (401)
  • EloqPermissionError: Permission denied (403)
  • EloqNotFoundError: Resource not found (404)
  • EloqRateLimitError: Rate limit exceeded (429)
  • EloqValidationError: Invalid request (400)
  • EloqServerError: Server error (500+)

Handling Errors

from eloq_sdk import EloqAPI
from eloq_sdk.exceptions import EloqAPIError, EloqNotFoundError

try:
cluster = client.cluster("non-existent-cluster")
except EloqNotFoundError:
print("Cluster not found")
except EloqAPIError as e:
print(f"API error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")

Operation Results

For create and delete operations, errors are automatically handled and returned as OperationResult objects:

result = client.cluster_create(
cluster_name="my-cluster",
region="us-west-1",
sku_id=123
)

if not result.success:
print(f"Operation failed: {result.message}")

Core API Methods

Basic:

  • org() - Get simplified organization information
  • info() - Get detailed organization and project information
  • get_skus() - Get available SKUs filtered by type, module, and cloud provider

Cluster Management:

Complete Examples

Full Workflow: Get SKUs → Create Cluster → Check Status → Delete Cluster

from eloq_sdk import EloqAPI
from eloq_sdk import schema

# Initialize client
client = EloqAPI.from_environ()

# Step 1: Get available SKUs
skus = client.get_skus(
sku_type=schema.SKUType.SERVERLESS,
eloq_module=schema.EloqModule.ELOQKV,
cloud_provider=schema.CloudProvider.AWS
)

if not skus:
print("No SKUs available")
exit(1)

# Step 2: Create cluster
result = client.cluster_create(
cluster_name="my-cluster",
region="us-west-1",
sku_id=skus[0].sku_id
)

if not result.success:
print(f"Failed to create cluster: {result.message}")
exit(1)

print(f"✅ {result.message}")

# Step 3: Check cluster status
cluster_info = client.cluster("my-cluster")
print(f"Cluster status: {cluster_info.status}")

# Step 4: Get credentials
credentials = client.cluster_credentials("my-cluster")
print(f"Connection: {credentials.host}:{credentials.port}")

# Step 5: Delete cluster (when done)
result = client.cluster_delete("my-cluster")
if result.success:
print(f"✅ {result.message}")

View the Eloq API for more information on the available endpoints and their parameters.