Skip to content

aingdb CLI

Usage

aingdb version | -v | --version              Show CLI version
aingdb sql --path <file> [-e "<SQL>"] [--audit] [--audit-file <log>]
aingdb explain --path <file> -e "<SELECT>"   EXPLAIN plan
aingdb analyze --path <file>                 Collect stats (ANALYZE)
aingdb create-index ...                      Create index
aingdb compact --path <file>                 Compact/VACUUM
aingdb backup --path <file> --out <file>     Backup file
aingdb restore --path <file> --from <file>   Restore file
aingdb snapshot --path <file>                Snapshot with timestamp

Common Flags

  • --audit enable audit trail for this run
  • --audit-file <path> set custom audit log path
  • Env: AINGDB_AUDIT=1 also enables audit

Commands

version | -v | --version

Description: Print CLI version.
Example:

bash
aingdb --version

sql

Description: Execute SQL/DDL/DML. Syntax: aingdb sql --path <file> -e "<SQL>" [--audit] [--audit-file <log>]

bash
aingdb sql --path ./app.adb -e "CREATE TABLE users(id UUID PRIMARY KEY, name TEXT)"
aingdb sql --path ./app.adb -e "INSERT INTO users(name) VALUES('Ain')"

explain

Description: Print a plan for a SELECT (placeholder).
Syntax: aingdb explain --path <file> -e "<SELECT>"

bash
aingdb explain --path ./app.adb -e "SELECT * FROM users WHERE name='Ain'"

analyze

Description: Gather stats.
Syntax: aingdb analyze --path <file>

bash
aingdb analyze --path ./app.adb

create-index

Description: Create a secondary index.
Syntax:

aingdb create-index --path <file> --name <index> --table <table> [--columns "col1,col2" | --expr "LOWER(name)"]

Example:

bash
aingdb create-index --path ./app.adb --name idx_users_name --table users --columns "name"

compact

Description: Rewrite and prune the WAL (VACUUM).
Syntax: aingdb compact --path <file>

backup

Description: Copy .adb to a backup.
Syntax: aingdb backup --path <file> --out <file>

restore

Description: Restore .adb from a backup.
Syntax: aingdb restore --path <file> --from <file>

snapshot

Description: Copy .adb with a timestamp suffix.
Syntax: aingdb snapshot --path <file>

Released under MIT License.