AI Interview SDK
v1.0.0
Quick Start Guide
Get up and running with the Torola Python SDK in just a few minutes. This guide walks you through creating a project, uploading data, and performing basic operations.
Prerequisites
Before you begin, make sure you have:
- Python 3.7 or higher installed
- A Torola account and API key
- Basic familiarity with Python
Setup
Follow these steps to set up your environment:
Terminal
# 1. Install the SDK
pip install torola-sdk
# 2. Set your API key
export TOROLA_API_KEY="your-api-key-here"
# 3. Run the quick start script
python quickstart.pyComplete Example
Here's a complete example that demonstrates the core functionality of the Torola SDK:
quickstart.py
#!/usr/bin/env python3
"""
Torola SDK Quick Start Guide
This example demonstrates the basic usage of the Torola Python SDK.
"""
import os
from torola import Torola
from torola.exceptions import TorolaError
def main():
# Initialize the Torola client
torola = Torola(api_key=os.getenv('TOROLA_API_KEY'))
try:
# Create a new project
print("Creating a new project...")
project = torola.projects.create(
name="Quick Start Project",
description="A sample project created with the Quick Start guide",
tags=["quickstart", "demo"]
)
print(f"✓ Project created: {project.name} (ID: {project.id})")
# Upload some sample data
print("\nUploading sample data...")
data = {
"users": [
{"id": 1, "name": "Alice", "email": "[email protected]"},
{"id": 2, "name": "Bob", "email": "[email protected]"},
{"id": 3, "name": "Charlie", "email": "[email protected]"}
]
}
dataset = torola.data.upload(
project_id=project.id,
data=data,
name="sample_users"
)
print(f"✓ Data uploaded: {dataset.name} ({len(data["users"])} records)")
# Query the data
print("\nQuerying data...")
results = torola.data.query(
project_id=project.id,
dataset_name="sample_users",
filters={"name": {"$contains": "a"}} # Find users with "a" in name
)
print(f"✓ Found {len(results)} users with "a" in their name:")
for user in results:
print(f" - {user["name"]} ({user["email"]})")
# Get project statistics
print("\nProject statistics:")
stats = torola.projects.get_stats(project.id)
print(f"✓ Total datasets: {stats.datasets}")
print(f"✓ Total records: {stats.records}")
print(f"✓ Storage used: {stats.storage_mb} MB")
print("\n🎉 Quick start completed successfully!")
except TorolaError as e:
print(f"❌ Error: {e}")
return 1
return 0
if __name__ == "__main__":
exit(main())What This Example Does
1. Initialize Client
Creates a Torola client instance using your API key from environment variables.
2. Create Project
Sets up a new project to organize your data and workflows.
3. Upload Data
Uploads sample user data to demonstrate data management capabilities.
4. Query Data
Performs a filtered query to find specific records in your dataset.
Next Steps
Now that you've completed the quick start, explore these areas: