HeliosDB-Lite SQLite Compatibility Troubleshooting Guide¶
This guide helps you quickly resolve common issues when using HeliosDB-Lite as a SQLite drop-in replacement.
Table of Contents¶
- Installation Issues
- Import and Module Errors
- Compatibility Issues
- Performance Problems
- Data Migration Issues
- Mode Switching Issues
- Connection and Threading Issues
- Testing and Debugging Tips
Installation Issues¶
Problem: pip install fails¶
Symptoms:
$ pip install heliosdb-sqlite
ERROR: Could not find a version that satisfies the requirement heliosdb-sqlite
Solutions:
-
Update pip and setuptools:
-
Check Python version:
-
Try specific version:
-
Install from source (if pre-built wheels unavailable):
Problem: Import works in terminal but not in IDE¶
Symptoms:
# Works in terminal
$ python -c "import heliosdb_sqlite"
# Fails in PyCharm/VSCode
ModuleNotFoundError: No module named 'heliosdb_sqlite'
Solutions:
- Verify IDE is using correct Python interpreter:
- PyCharm: Settings > Project > Python Interpreter
-
VSCode: Select interpreter from command palette (Ctrl+Shift+P)
-
Install in IDE's environment:
-
Restart IDE after installation
Import and Module Errors¶
Problem: "No module named 'heliosdb_sqlite'"¶
Symptoms:
Solutions:
-
Verify installation:
-
Check virtual environment:
-
Reinstall package:
Problem: AttributeError with HeliosDB-Lite methods¶
Symptoms:
conn = sqlite3.connect('app.db')
conn.some_method()
# AttributeError: 'Connection' object has no attribute 'some_method'
Solutions:
-
Check if method is standard SQLite:
-
Use HeliosDB-Lite specific features correctly:
-
Check API documentation:
Compatibility Issues¶
Problem: Existing code breaks with HeliosDB-Lite¶
Symptoms:
# Code worked with SQLite but fails with HeliosDB-Lite
cursor.execute('SELECT * FROM users')
# Some error occurs
Solutions:
-
Enable compatibility mode:
-
Check for unsupported features:
# Test basic operations one by one import heliosdb_sqlite as sqlite3 conn = sqlite3.connect(':memory:') cursor = conn.cursor() # Test CREATE cursor.execute('CREATE TABLE test (id INTEGER, name TEXT)') print("CREATE: OK") # Test INSERT cursor.execute('INSERT INTO test VALUES (1, "test")') conn.commit() print("INSERT: OK") # Test SELECT cursor.execute('SELECT * FROM test') print(f"SELECT: {cursor.fetchall()}") # Test UPDATE cursor.execute('UPDATE test SET name = "updated" WHERE id = 1') conn.commit() print("UPDATE: OK") # Test DELETE cursor.execute('DELETE FROM test WHERE id = 1') conn.commit() print("DELETE: OK") -
Use fallback pattern:
Problem: SQL syntax not recognized¶
Symptoms:
Solutions:
-
Verify SQL is standard SQLite syntax:
# Test query in standard SQLite first import sqlite3 as std_sqlite test_conn = std_sqlite.connect(':memory:') test_conn.execute('CREATE TABLE users (id INTEGER, name TEXT)') test_conn.execute('INSERT INTO users VALUES (1, "test")') result = test_conn.execute('SELECT * FROM users LIMIT 10 OFFSET 5') print(result.fetchall()) -
Check for HeliosDB-Lite specific syntax:
-
Use parameterized queries:
Performance Problems¶
Problem: Queries are slower than SQLite¶
Symptoms:
# Query takes longer than expected
start = time.time()
cursor.execute('SELECT * FROM large_table')
results = cursor.fetchall()
print(f"Time: {time.time() - start:.2f}s") # Slower than SQLite
Solutions:
-
Create appropriate indexes:
# Check if indexes exist cursor.execute("SELECT name FROM sqlite_master WHERE type='index'") print("Existing indexes:", cursor.fetchall()) # Create missing indexes cursor.execute('CREATE INDEX IF NOT EXISTS idx_user_email ON users(email)') cursor.execute('CREATE INDEX IF NOT EXISTS idx_post_date ON posts(created_at)') conn.commit() -
Enable query caching:
-
Use batch operations:
# Slow: individual inserts for user in users: cursor.execute('INSERT INTO users VALUES (?, ?)', user) conn.commit() # Don't commit each insert! # Fast: batch with single commit for user in users: cursor.execute('INSERT INTO users VALUES (?, ?)', user) conn.commit() # Single commit at end # Fastest: executemany cursor.executemany('INSERT INTO users VALUES (?, ?)', users) conn.commit() -
Analyze query plans:
-
Adjust connection settings:
# Tune for performance conn = sqlite3.connect( 'app.db', isolation_level='DEFERRED', # Less locking check_same_thread=False, # Multi-threaded cached_statements=100, # Cache prepared statements timeout=30.0 # Longer timeout ) # Set pragmas conn.execute('PRAGMA journal_mode=WAL') conn.execute('PRAGMA synchronous=NORMAL') conn.execute('PRAGMA cache_size=10000') conn.execute('PRAGMA temp_store=MEMORY')
Problem: High memory usage¶
Symptoms:
Solutions:
-
Close connections properly:
-
Fetch data in chunks:
-
Limit cache size:
-
Vacuum database:
Data Migration Issues¶
Problem: Can't open existing SQLite database¶
Symptoms:
Solutions:
-
Check database integrity:
-
Repair database:
-
Check file permissions:
Problem: Data looks corrupted after switching to HeliosDB-Lite¶
Symptoms:
# Data appears incorrect or missing
cursor.execute('SELECT * FROM users')
results = cursor.fetchall()
# Results don't match expectations
Solutions:
-
Verify with SQLite first:
import sqlite3 as std_sqlite # Check with standard SQLite std_conn = std_sqlite.connect('app.db') std_cursor = std_conn.cursor() std_cursor.execute('SELECT COUNT(*) FROM users') print(f"SQLite sees: {std_cursor.fetchone()[0]} users") # Check with HeliosDB-Lite import heliosdb_sqlite hdb_conn = heliosdb_sqlite.connect('app.db') hdb_cursor = hdb_conn.cursor() hdb_cursor.execute('SELECT COUNT(*) FROM users') print(f"HeliosDB-Lite sees: {hdb_cursor.fetchone()[0]} users") -
Check transaction isolation:
-
Flush caches:
Mode Switching Issues¶
Problem: Can't start server mode¶
Symptoms:
Solutions:
-
Check if port is in use:
-
Use different port:
-
Check permissions:
Problem: Hybrid mode not working¶
Symptoms:
conn = sqlite3.connect('app.db', heliosdb_mode='hybrid')
# Can't connect remotely even though server should be running
Solutions:
-
Check server info:
-
Check firewall:
-
Test connection:
Connection and Threading Issues¶
Problem: "SQLite objects created in a thread can only be used in that same thread"¶
Symptoms:
conn = sqlite3.connect('app.db')
# Use connection from different thread
# Error: SQLite objects created in a thread can only be used in that same thread
Solutions:
-
Disable thread checking:
-
Use connection per thread:
import threading thread_local = threading.local() def get_connection(): if not hasattr(thread_local, 'conn'): thread_local.conn = sqlite3.connect('app.db') return thread_local.conn # Each thread gets its own connection def worker(): conn = get_connection() cursor = conn.cursor() cursor.execute('SELECT * FROM users') -
Use connection pooling:
Problem: Concurrent write deadlocks¶
Symptoms:
Solutions:
-
HeliosDB-Lite should handle this, but if it happens:
# Increase timeout conn = sqlite3.connect('app.db', timeout=30.0) # Use retry logic import time def write_with_retry(query, params, max_retries=3): for attempt in range(max_retries): try: cursor.execute(query, params) conn.commit() return except sqlite3.OperationalError as e: if 'locked' in str(e) and attempt < max_retries - 1: time.sleep(0.1 * (2 ** attempt)) # Exponential backoff else: raise -
Check if you're actually using HeliosDB-Lite:
Testing and Debugging Tips¶
Enable debug logging¶
import heliosdb_sqlite as sqlite3
import logging
# Enable debug logging
logging.basicConfig(level=logging.DEBUG)
sqlite3.enable_debug_logging()
# Now all database operations are logged
conn = sqlite3.connect('app.db')
cursor = conn.cursor()
cursor.execute('SELECT * FROM users')
Compare behavior with SQLite¶
import sqlite3 as std_sqlite
import heliosdb_sqlite as hdb_sqlite
def test_query(db_module, name):
try:
conn = db_module.connect(':memory:')
cursor = conn.cursor()
cursor.execute('CREATE TABLE test (id INTEGER, value TEXT)')
cursor.execute('INSERT INTO test VALUES (1, "hello")')
conn.commit()
cursor.execute('SELECT * FROM test')
result = cursor.fetchall()
print(f"{name}: {result}")
conn.close()
return True
except Exception as e:
print(f"{name} failed: {e}")
return False
# Test both
test_query(std_sqlite, "SQLite")
test_query(hdb_sqlite, "HeliosDB-Lite")
Isolate the problem¶
# Minimal reproducible example
import heliosdb_sqlite as sqlite3
# Test with in-memory database (simpler)
conn = sqlite3.connect(':memory:')
cursor = conn.cursor()
# Test your exact failing query
try:
cursor.execute('YOUR FAILING QUERY HERE')
print("Query succeeded!")
except Exception as e:
print(f"Query failed: {e}")
import traceback
traceback.print_exc()
Check HeliosDB-Lite version and capabilities¶
import heliosdb_sqlite as sqlite3
print(f"HeliosDB-Lite version: {sqlite3.__version__}")
print(f"SQLite version: {sqlite3.sqlite_version}")
# Check available features
conn = sqlite3.connect(':memory:')
features = conn.get_features()
print(f"Vector search: {features.vector_search}")
print(f"Time-travel: {features.time_travel}")
print(f"Branching: {features.branching}")
print(f"Encryption: {features.encryption}")
Generate diagnostic report¶
def generate_diagnostic_report():
import heliosdb_sqlite as sqlite3
import sys
import platform
print("=== HeliosDB-Lite Diagnostic Report ===\n")
print(f"Python version: {sys.version}")
print(f"Platform: {platform.platform()}")
print(f"HeliosDB-Lite version: {sqlite3.__version__}")
print(f"SQLite version: {sqlite3.sqlite_version}")
print("\nTesting basic operations...")
try:
conn = sqlite3.connect(':memory:')
cursor = conn.cursor()
cursor.execute('CREATE TABLE test (id INTEGER)')
cursor.execute('INSERT INTO test VALUES (1)')
cursor.execute('SELECT * FROM test')
result = cursor.fetchall()
print(f"Basic operations: OK")
print(f"Result: {result}")
conn.close()
except Exception as e:
print(f"Basic operations: FAILED")
print(f"Error: {e}")
print("\n=== End Diagnostic Report ===")
# Run diagnostic
generate_diagnostic_report()
Getting Help¶
If you've tried these solutions and still have issues:
- Check GitHub Issues: https://github.com/heliosdb/heliosdb-lite/issues
- Ask on Stack Overflow: Tag with
heliosdb - Join Discord Community: Real-time help from users
- Email Support: support@heliosdb.io
When asking for help, include:
- HeliosDB-Lite version (sqlite3.__version__)
- Python version
- Operating system
- Minimal code that reproduces the issue
- Full error message and traceback
- What you've already tried
Common Error Messages¶
"database is locked"¶
Cause: Multiple processes trying to write simultaneously (shouldn't happen with HeliosDB-Lite!)
Fix:
# Verify you're actually using HeliosDB-Lite
import heliosdb_sqlite as sqlite3
print(sqlite3.__name__) # Should be 'heliosdb_sqlite'
# If confirmed HeliosDB-Lite, increase timeout
conn = sqlite3.connect('app.db', timeout=30.0)
"no such table"¶
Cause: Table doesn't exist or transaction issues
Fix:
# List all tables
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
print("Available tables:", cursor.fetchall())
# Create table if missing
cursor.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER, name TEXT)')
"disk I/O error"¶
Cause: Permissions, disk space, or hardware issues
Fix:
# Check disk space
df -h
# Check permissions
ls -la database.db
# Check disk health
# Linux: sudo smartctl -H /dev/sda
# Mac: diskutil verifyVolume /
Prevention Tips¶
-
Always use context managers:
-
Use parameterized queries:
-
Handle exceptions:
-
Test thoroughly:
-
Monitor in production:
For more help:
- HELIOSDB_SQLITE_DROP_IN_GUIDE.md - Getting started
- HELIOSDB_SQLITE_FAQ.md - Common questions
- HELIOSDB_SQLITE_ADVANCED_FEATURES.md - Advanced usage
- GitHub Issues - Bug reports and discussions