A Python application that converts natural language questions into SQL queries for querying host information from a PostgreSQL database. Uses Ollama's Mistral model and LangChain for query generation.
- Python 3.x
- PostgreSQL database
- Ollama running locally
- Mistral model installed in Ollama
- Install required packages:
pip3 install -r requirements.txtexport DB_NAME= export DB_USER= export DB_PASSWORD= export DB_HOST=localhost export DB_PORT=5442
python3 src/main.py
- Generate SQL queries from natural language
- Execute the queries
- Display formatted results
- Example Questions
- "Display the records which has os as Linux and return only upto 10 records"
- "Display the records with more than 4 cores and return only upto 10 record"
- Export sensitive information as environment variables