{"library":"sqltree","title":"sqltree","type":"library","description":"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.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install sqltree"],"cli":{"name":"sqltree","version":null}},"imports":["npx sqltree","npm install -g sqltree\nsqltree","npx sqltree --uri postgresql://user:pass@host:port/database"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://sqltree.app","github":"https://github.com/logicalangel/sqltree","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/sqltree","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"const { spawn } = require('child_process');\n\n// Example: Connect to a PostgreSQL database using a URI from an environment variable.\n// This demonstrates programmatically launching the sqltree CLI.\n// Replace 'your_user', 'your_password', 'localhost', '5432', 'your_database_name' with actual values.\n// For security, it's recommended to use environment variables for sensitive data.\nconst DB_URI = process.env.SQLTREE_PG_URI ?? 'postgresql://your_user:your_password@localhost:5432/your_database_name';\n\nconsole.log(`Launching sqltree to connect to: ${DB_URI.replace(/:[^@]+@/, ':*****@')}`); // Mask password for logging\n\nconst child = spawn('npx', ['sqltree', '--uri', DB_URI], {\n  stdio: 'inherit', // Allows sqltree's TUI to render in the current terminal\n  shell: true // Required for 'npx' command to be found on some systems\n});\n\nchild.on('error', (err) => {\n  console.error('Failed to start sqltree process:', err);\n});\n\nchild.on('close', (code) => {\n  if (code !== 0) {\n    console.error(`sqltree process exited with code ${code}`);\n  } else {\n    console.log('sqltree process exited successfully.');\n  }\n});","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}