Installation & Setup Guide
Prerequisites
- Python 3.10+
- pip or uv
- A supported database (Postgres, MySQL, Snowflake, BigQuery, Databricks, Oracle, or SQLite)
Installation
From PyPI
pip install terno-dbi
From Source (Development)
git clone https://github.com/terno-ai/ternodbi
cd ternodbi
pip install -e .
Configuration
TernoDBI works out-of-the-box with SQLite, but production use requires configuring environment variables.
Environment Variables
| Variable | Description | Default |
|---|---|---|
DBI_SECRET_KEY |
Django cryptographic signing key. Change this in prod! | django-insecure... |
DBI_DEBUG |
Enable debug mode (detailed errors). | True |
DBI_ALLOWED_HOSTS |
Comma-separated list of allowed hostnames. | * |
DATABASE_ENGINE |
Primary backend DB: MYSQL, POSTGRESQL, or empty (SQLite).
|
SQLite |
Database Specific Configuration
PostgreSQL (DATABASE_ENGINE=POSTGRESQL)
POSTGRES_DBPOSTGRES_USERPOSTGRES_PASSPOSTGRES_HOSTPOSTGRES_PORT
MySQL (DATABASE_ENGINE=MYSQL)
MYSQL_DBMYSQL_USERMYSQL_PASSMYSQL_HOSTMYSQL_PORT
Running the Server
-
Start the Server:
ternodbi startThis single command automatically runs database migrations, creates a default admin user, and starts the API server.
- The Health Check will be available at:
http://localhost:8376/api/health/ - The Admin Console will be at:
http://localhost:8376/admin/
- The Health Check will be available at:
Creating Your First User & Token
-
Create Superuser (if you don't want to use the default
admin/admin):ternodbi manage createsuperuser -
Issue API Token (for Agents):
ternodbi manage issue_token --name "MyFirstAgent" --type query