@nine-lab/nine-connector
v0.1.25
Published
NineQuery AI Connector for Database
Downloads
2,653
Readme
cat < README.md
@nine-lab/nine-connector 🚀
한국어 문서(Korean) | English Document
NineConnector is an AI-specialized database connector service that bridges the gap between natural language SQL generation engines (NineQuery) and your database.
It analyzes database schemas to provide AI models with the necessary metadata for optimal query generation and ensures secure data retrieval within a verified environment.
🌟 Key Features
- Auto-Initialization: Instantly set up your environment with `.env` configurations and AI prompt templates using the `nine-connector init` command.
- Multi-DB Support: Out-of-the-box compatibility with enterprise database environments including MySQL, PostgreSQL, MariaDB, and Oracle.
- Business Logic Optimization: Fine-tune AI behavior by customizing prompt files to enforce rules such as table access restrictions or mandatory filtering logic.
- Security Guardrail: Strictly restricts execution to `SELECT` queries to prevent unauthorized data modification or leakage.
- Operational Stability: Ensures data consistency through BigInt serialization and standardized result formatting across different DB dialects.
🛠 Installation & Quick Start
1. Install Package
Install the package globally to access the CLI commands from anywhere. ```bash npm install -g @nine-lab/nine-connector ```
2. Initialize Project (First-time setup)
Run the initialization command to configure DB connection settings and generate prompt templates. ```bash nine-connector init ```
3. Server Execution & Management (PM2 Recommended)
For production environments, we highly recommend using PM2 to ensure high availability and efficient log management.
- Start Server: ```bash pm2 start nine-connector --name "nine-connector" ```
- Check Status: ```bash pm2 status ```
- View Logs: ```bash pm2 logs nine-connector ```
- Stop / Restart: ```bash pm2 stop nine-connector pm2 restart nine-connector ```
📂 Project Structure & Customization
Designed to work seamlessly with the `nine-query` component, you can control the AI's behavior via the following files:
- .env: Database credentials and AI model (e.g., Gemini) configurations.
- prompts/table-filter.md: AI logic for identifying relevant tables based on user intent.
- prompts/query-generator.md: Persona and rules for the SQL generation AI.
- 💡 Tip: Use the `[Custom Business Logic & Security Rules]` section in this file to enforce specific constraints, such as "Do not access sensitive user tables" or "Always apply a default sort order."
📄 License
MIT © nine-lab EOF
