sqltree is an interactive Terminal User Interface (TUI) client designed for seamless navigation and interaction with PostgreSQL and MySQL databases. It currently ships with version 1.4.7, with updates primarily driven by dependency bumps and feature enhancements, indicating active development. The tool differentiates itself through a two-column layout featuring a navigable tree browser for databases, schemas, and tables on one side, and a full-screen SQL REPL with auto-completion on the other. It supports paginated data browsing, result export to CSV/JSON, and persistent connection profiles, all within a unified interface for both database types. sqltree runs on Node.js 20 or higher.
npm install sqltreeVerified import paths — ran on the pinned version, not inferred.
This Node.js script demonstrates how to programmatically launch the `sqltree` CLI tool via `npx`, connecting to a PostgreSQL database using a connection URI. It uses `child_process.spawn` to inherit the terminal's I/O, allowing the interactive TUI to function.
Ensure your user's home directory is properly secured and avoid sharing the `connections.json` file. Consider using environment variables for credentials in automated scripts.
Upgrade your Node.js installation to version 20 or later. Use a version manager like `nvm` to easily switch Node.js versions (e.g., `nvm install 20 && nvm use 20`).
Invoke sqltree directly from your terminal using `npx sqltree` or a globally installed `sqltree` command. For scripting, use Node.js's `child_process` module to run the CLI.
Run `sqltree` using `npx sqltree` to execute it without a global installation, or install it globally with `npm install -g sqltree`.
Verify that your database server is running, check the host address and port in your connection string or arguments, and ensure no firewall rules are blocking the connection from your machine.
Ensure you have a stable internet connection for `npx` to download dependencies. If `sqltree` is installed globally, try reinstalling it with `npm install -g sqltree`. For programmatic usage via `child_process`, ensure `npx` is in your PATH.