SQLite¶
Connect HolmesGPT to SQLite databases to analyze query performance, examine table schemas, check index usage, and read data for troubleshooting local databases.
You can configure multiple SQLite instances with different names (e.g., dev-sqlite, test-sqlite, app-cache-sqlite).
File Permissions¶
Ensure the database file is accessible:
# Make database readable
chmod 644 /path/to/database.db
# If Holmes runs as specific user, ensure ownership
chown holmes:holmes /path/to/database.db
# Or use group access
chmod 664 /path/to/database.db
chgrp holmes-group /path/to/database.db
Configuration¶
Connection URL format:
Important: Use four slashes (////) for absolute paths:
sqlite:////home/user/app.db- Absolute path on Linux/Macsqlite:////var/lib/app/data.db- Another Linux example
In Kubernetes, the database file is read from a mounted volume. Each Kubernetes example on this page mounts it with a hostPath volume of type: File, which requires the file to exist at that path on the node the Holmes pod is scheduled on; where it does not, the volume fails to mount and the pod does not start.
~/.holmes/config.yaml:
toolsets:
dev-sqlite:
type: database
config:
connection_url: "sqlite:////absolute/path/to/database.db"
llm_instructions: "Local development database with test data"
app-cache-sqlite:
type: database
config:
connection_url: "sqlite:////var/lib/app/cache.db"
llm_instructions: "Application cache database"
In-memory database (testing only):
When using the standalone Holmes Helm Chart, merge this into your values.yaml, appending list entries (such as additionalEnvVars) to the lists already there:
additionalVolumes:
- name: sqlite-db
hostPath:
path: /path/on/host/database.db
type: File
additionalVolumeMounts:
- name: sqlite-db
mountPath: /data/database.db
readOnly: true
toolsets:
app-sqlite:
type: database
config:
connection_url: "sqlite:////data/database.db"
llm_instructions: "Application database mounted from host"
Apply the configuration:
When using the Robusta Helm Chart (which includes HolmesGPT), merge the keys under holmes: into the holmes: key of your generated_values.yaml (add one if it has none), appending list entries (such as additionalEnvVars) to the lists already there:
holmes:
additionalVolumes:
- name: sqlite-db
hostPath:
path: /path/on/host/database.db
type: File
additionalVolumeMounts:
- name: sqlite-db
mountPath: /data/database.db
readOnly: true
toolsets:
app-sqlite:
type: database
config:
connection_url: "sqlite:////data/database.db"
llm_instructions: "Application database mounted from host"
Apply the configuration:
Multiple instances¶
Add the following to ~/.holmes/config.yaml, with the paths of the database files on your machine. Create the file if it doesn't exist:
toolsets:
app-sqlite:
type: database
config:
connection_url: "sqlite:////absolute/path/to/app.db"
cache-sqlite:
type: database
config:
connection_url: "sqlite:////absolute/path/to/cache.db"
After making changes to your configuration, run:
When using the standalone Holmes Helm Chart, merge this into your values.yaml, appending list entries (such as additionalEnvVars) to the lists already there:
additionalVolumes:
- name: app-db
hostPath:
path: /data/app.db
type: File
- name: cache-db
hostPath:
path: /data/cache.db
type: File
additionalVolumeMounts:
- name: app-db
mountPath: /data/app.db
readOnly: true
- name: cache-db
mountPath: /data/cache.db
readOnly: true
toolsets:
app-sqlite:
type: database
config:
connection_url: "sqlite:////data/app.db"
cache-sqlite:
type: database
config:
connection_url: "sqlite:////data/cache.db"
Apply the configuration:
When using the Robusta Helm Chart (which includes HolmesGPT), merge the keys under holmes: into the holmes: key of your generated_values.yaml (add one if it has none), appending list entries (such as additionalEnvVars) to the lists already there:
holmes:
additionalVolumes:
- name: app-db
hostPath:
path: /data/app.db
type: File
- name: cache-db
hostPath:
path: /data/cache.db
type: File
additionalVolumeMounts:
- name: app-db
mountPath: /data/app.db
readOnly: true
- name: cache-db
mountPath: /data/cache.db
readOnly: true
toolsets:
app-sqlite:
type: database
config:
connection_url: "sqlite:////data/app.db"
cache-sqlite:
type: database
config:
connection_url: "sqlite:////data/cache.db"
Apply the configuration:
Configuration Options¶
- connection_url (required): SQLite connection URL
- read_only (default:
true): Only allow SELECT/SHOW/DESCRIBE/EXPLAIN/WITH statements - max_rows (default:
200): Maximum rows to return (1-10000) - llm_instructions: Context about this database