Python SDK for TitanRdm Upload and Download APIs
Project description
TitanRDM SDK for Python
Python SDK for TitanRDM Upload and Download APIs.
Installation
pip install titan-rdm-sdk
For development:
pip install titan-rdm-sdk[dev]
Quick Start
Initialize Client
from titan_rdm_sdk import TitanRDMClient
client = TitanRDMClient(
url="https://<tenant_subdomain>.titanrdm.com",
client_id="your_client_id",
client_secret="your_client_secret"
)
Download Data (Full Export)
download = client.get_download(
branch_id=174,
table_definition_key=50,
pattern='full',
correlation_code='daily-export-2025-01-22'
)
download.wait_until_ready(poll_interval=2.0, max_wait=300.0)
df = download.receive()
print(f"Downloaded {len(df)} rows")
Download Data (Incremental Export)
download = client.get_download(
branch_id=174,
table_definition_key=50,
pattern='incremental',
high_water_mark="2025-01-21T00:00:00Z",
correlation_code='incremental-sync'
)
download.wait_until_ready()
df = download.receive()
Upload Data
import pandas as pd
# Create upload batch
upload = client.get_upload(
branch_id=174,
description='Customer data update',
correlation_code='batch-001'
)
# Prepare data
df = pd.DataFrame({
'customer_id': [1, 2, 3],
'name': ['Alice', 'Bob', 'Charlie'],
'email': ['alice@example.com', 'bob@example.com', 'charlie@example.com']
})
# Upload to specific table
table_upload = upload.get_table_upload(
table_definition_key=456,
import_mapping_key=123,
pattern='full'
)
table_upload.send(df)
# Complete the import batch
upload.complete()
Error Handling
from titan_rdm_sdk import (
TitanRDMClient,
AuthenticationError,
APIError,
ExportFailedError,
ValidationError
)
try:
client = TitanRDMClient(url, client_id, client_secret)
download = client.get_download(branch_id=174, table_definition_key=50)
download.wait_until_ready()
df = download.receive()
except AuthenticationError as e:
print(f"Authentication failed: {e}")
except ValidationError as e:
print(f"Invalid input: {e}")
except ExportFailedError as e:
print(f"Export failed: {e}")
except APIError as e:
print(f"API error (HTTP {e.status_code}): {e}")
Development
Setup
# Clone the repository
git clone https://github.com/dimodelo/titan-rdm-sdk-python.git
cd titan-rdm-sdk-python
# Install in development mode
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest
# Run with verbose output
pytest -v
# Run with coverage report
pytest --cov=titan_rdm_sdk --cov-report=term-missing
# Run specific test file
pytest tests/test_client.py
# Run specific test class or function
pytest tests/test_client.py::TestClientInitialization
pytest tests/test_client.py::TestClientInitialization::test_successful_initialization
Building the Package
pip install build
python -m build
This creates distribution files in the dist/ directory that can be uploaded to PyPI.
License
MIT
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
titan_rdm_sdk-0.1.0.tar.gz
(18.5 kB
view details)
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 titan_rdm_sdk-0.1.0.tar.gz.
File metadata
- Download URL: titan_rdm_sdk-0.1.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3b60482e77ba7bb29aac9f6b778b753ae6b87a31b509693502bcb8de6090d87
|
|
| MD5 |
18fafaacfb8d9547837f2319dd77d25b
|
|
| BLAKE2b-256 |
7709d1fe81a6cc2f4235f16d64b9b795efa463b72441ce13c189ab6c9efd7d52
|
File details
Details for the file titan_rdm_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: titan_rdm_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
339d8a08fe68b212fd11cf35a8cb9b2bb5c5d9805090c7699a081e2fb7e80478
|
|
| MD5 |
078993ffb367373c9c1d07a6b4b9d04e
|
|
| BLAKE2b-256 |
67b3b79f2c81b9499cd79825cfd132a89018208634c86648bb6df8d5499fd8bd
|