Quick Start Guide
Quick Start Guide
Get up and running with HeliosDB Nano in 5 minutes.
Create a Database
=== “Rust”
```rustuse heliosdb_nano::EmbeddedDatabase;
fn main() -> Result<(), Box<dyn std::error::Error>> { // File-based database let db = EmbeddedDatabase::new("./mydb")?;
// Or in-memory let db = EmbeddedDatabase::new_in_memory()?;
Ok(())}```=== “Python”
```pythonfrom heliosdb_nano import Client
# Connect to serverclient = Client("http://localhost:8080")
# Or embeddedfrom heliosdb_nano import EmbeddedDatabasedb = EmbeddedDatabase("./mydb")```=== “CLI”
```bash# Start REPL with file databaseheliosdb-nano repl --data-dir ./mydb
# Or in-memoryheliosdb-nano repl --memory```Create Tables
-- Users tableCREATE TABLE users ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
-- Orders table with foreign key conceptCREATE TABLE orders ( id INTEGER PRIMARY KEY, user_id INTEGER NOT NULL, total DECIMAL(10,2), status TEXT DEFAULT 'pending');Insert Data
-- Single insertINSERT INTO users (id, name, email) VALUES (1, 'Alice', 'alice@example.com');
-- Multiple rowsINSERT INTO users (id, name, email) VALUES (2, 'Bob', 'bob@example.com'), (3, 'Carol', 'carol@example.com');
-- Insert with RETURNINGINSERT INTO orders (user_id, total) VALUES (1, 99.99) RETURNING id;Query Data
-- Basic querySELECT * FROM users;
-- With conditionsSELECT name, email FROM users WHERE id > 1;
-- Join tablesSELECT u.name, o.totalFROM users uJOIN orders o ON u.id = o.user_id;
-- AggregationSELECT user_id, SUM(total) as total_spentFROM ordersGROUP BY user_id;Try Advanced Features
Time-Travel Queries
-- Query data as it existed yesterdaySELECT * FROM orders AS OF TIMESTAMP '2025-01-14 00:00:00';Database Branching
-- Create a development branchCREATE DATABASE BRANCH dev FROM main;
-- Switch to branchUSE BRANCH dev;
-- Make changes safelyDELETE FROM users WHERE id = 1;
-- Switch backUSE BRANCH main;-- Original data is still there!Vector Search
-- Create table with vector columnCREATE TABLE documents ( id INTEGER PRIMARY KEY, content TEXT, embedding VECTOR(384));
-- Insert with embeddingINSERT INTO documents (id, content, embedding)VALUES (1, 'Machine learning basics', '[0.1, 0.2, ...]');
-- Similarity searchSELECT content FROM documentsORDER BY embedding <-> '[0.15, 0.25, ...]'LIMIT 5;REPL Tips
# Show help\h
# List tables\d
# Describe table\d users
# Show branches\branches
# Toggle timing\timingNext Steps
- SQL Reference - Complete SQL syntax
- REPL Commands - All meta commands
- Features - Branching, time-travel, vectors