Loading documentation…
Preparing this guide.
Guide for integrating new backend capabilities.
This guide explains how to interface with the new backend features: SSH Tunneling, Visual Query Builder, and Data Seeding.
Securely connect to Postgres or MySQL databases via a jump host.
When creating a connection via add_connection, the DatabaseInfo object supports an optional ssh_config for Postgres and MySQL.
JSON Structure:
{
"Postgres": {
"connection_string": "postgres://user:pass@internal-db:5432/dbname",
"ssh_config": {
"host": "jump.example.com",
"port": 22,
"username": "admin",
"private_key_path": "/path/to/id_rsa", // Optional
"password": "secret" // Optional
}
}
}SshConfig object.add_connection, update_connection, or test_connection command.The backend handles establishing the tunnel implicitly.
Convert between SQL strings and structured AST (Abstract Syntax Tree) for visual editing.
1. Parse SQL (parse_sql)
sql (String) - e.g., SELECT * FROM usersJSON - The AST representation of the query.2. Build SQL (build_sql)
ast (JSON) - The AST received from parse_sql or modified by the UI.String - The generated SQL query.parse_sql with the current editor content.build_sql to get the string for the code editor.Populate tables with realistic mock data.
seed_tableInputs:
connection_id: UUID of the active connection.table_name: Name of the target table.schema_name: (Optional) Schema name, defaults to public on Postgres.count: Number of rows to generate (e.g., 100).seed_table.Reference table for accessing system metrics and export features.
| Metric | Source Command | Field | Frontend Example Code |
|---|---|---|---|
| Connection Created | get_connections | created_at | new Date(conn.created_at).toLocaleString() |
| Connection Updated | get_connections | updated_at | new Date(conn.updated_at).toLocaleString() |
| Last Connected | get_connections | last_connected_at | formatDistanceToNow(conn.last_connected_at) |
| DB Size (Bytes) | get_database_metadata | size_bytes | formatBytes(meta.size_bytes) |
| Total Rows | get_database_metadata | row_count_total | meta.row_count_total.toLocaleString() |
| Last DB Activity | get_database_metadata | last_updated | formatRelative(meta.last_updated) |
| Query Duration | fetch_query | execution_time_ms | event.payload.elapsed_ms |
| Feature | Command | Supported Formats | Frontend Logic |
|---|---|---|---|
| Table Export | export_table | CSV, JSON, SQL | Prompt user for format, then invoke command. Returns file path or content. |
| Database Dump | dump_database | SQL | Prompt user for target path, invoke command to stream dump. |
Protect saved credentials with an optional PIN.
1. Set PIN (set_connection_pin)
connection_id (UUID)pin (String?) - Pass null to remove PIN.2. Verify & Reveal (verify_pin_and_get_credentials)
connection_id (UUID)pin (String)Option<String> (the password) if PIN matches. Returns Error if PIN is invalid.conn.pin_hash. If present, show "Unlock to view credentials".verify_pin_and_get_credentials.AI-powered SQL assistance for query writing and explanation.
ai_set_provider("gemini" | "ollama")ai_set_gemini_key("AIza...")ai_configure_ollama(endpoint="http://localhost:11434")ai_complete(prompt, connection_id)
connection_id is provided.