Metadata-Version: 2.4
Name: natquery
Version: 1.0.1
Summary: Interact with PostgreSQL databases using natural language via a secure, performance-aware CLI
Author-email: Tanmai Raghava <tanmairaghava@kgpian.iitkgp.ac.in>, Krishna Chaitanya <krish89@kgpian.iitkgp.ac.in>, Thania Joshi <thaniavjoshi@kgpian.iitkgp.ac.in>, Lokeswara Reddy <lokeswarareddy2006@gmail.com>, Manasa Vankam <vankammanasa45@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/N-T-Raghava/NatQuery
Project-URL: Documentation, https://github.com/N-T-Raghava/NatQuery#readme
Project-URL: Repository, https://github.com/N-T-Raghava/NatQuery
Project-URL: Issues, https://github.com/N-T-Raghava/NatQuery/issues
Project-URL: Changelog, https://github.com/N-T-Raghava/NatQuery/blob/main/CHANGELOG.md
Keywords: nlp,database,postgres,natural-language,cli,llm
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: psycopg2-binary>=2.9.0
Requires-Dist: groq>=0.4.0
Requires-Dist: rich>=13.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black==25.1.0; extra == "dev"
Requires-Dist: ruff==0.15.6; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Dynamic: license-file

# NatQuery
natquery is a Python package that enables users to interact with relational databases using natural language via a secure, performance-aware command-line interface along with database driven machine learning analytics.

```
natquery/
│
├── pyproject.toml
├── README.md
├── requirements.txt
│── src/
├   ├── natquery/
│       ├── __init__.py
│
│       # =========================
│       # 1. CLI LAYER
│       # =========================
│       ├── cli/
│       │   ├── __init__.py
│       │   ├── main.py              # Entry point
│       │   ├── shell.py             # Interactive REPL
│       │   ├── commands.py          # CLI command registry
│
│       # =========================
│       # 2. CONFIG LAYER
│       # =========================
│       ├── config/
│       │   ├── __init__.py
│       │   ├── settings.py          # API keys, DB config
│       │   ├── connection.py        # PostgreSQL connection manager
│
│       # =========================
│       # 3. ORCHESTRATION LAYER
│       # =========================
│       ├── orchestration/
│       │   ├── __init__.py
│       │   ├── pipeline.py          # End-to-end coordinator
│       │   ├── error_handler.py
│
│       # =========================
│       # 4. SCHEMA MODULE
│       # =========================
│       ├── schema/
│       │   ├── __init__.py
│       │   ├── extractor.py         # Dynamic schema extraction
│       │   ├── formatter.py         # Convert schema to prompt-friendly text
│
│       # =========================
│       # 5. PROMPT BUILDER
│       # =========================
│       ├── prompt/
│       │   ├── __init__.py
│       │   ├── builder.py           # Structured prompt construction
│
│       # =========================
│       # 6. LLM CLIENT
│       # =========================
│       ├── llm/
│       │   ├── __init__.py
│       │   ├── client.py            # LLM API calls
│       │   ├── self_corrector.py    # Retry & correction mechanism
│
│       # =========================
│       # 7. SECURITY + VALIDATION
│       # =========================
│       ├── security/
│       │   ├── __init__.py
│       │   ├── validator.py         # SELECT-only enforcement
│       │   ├── limiter.py           # LIMIT enforcement
│
│       # =========================
│       # 8. EXECUTION ENGINE
│       # =========================
│       ├── execution/
│       │   ├── __init__.py
│       │   ├── engine.py            # SQL execution
│       │   ├── explain.py           # EXPLAIN / ANALYZE
│
│       # =========================
│       # 9. MACHINE LEARNING
│       # =========================
│       ├── ml/
│       │   ├── __init__.py
│       │   ├── preprocessing.py
│       │   ├── trainer.py
│       │   ├── inference.py
│       │
│       # =========================
│       # 10. PERFORMANCE + LOGGING
│       # =========================
│       ├── observability/
│          ├── __init__.py
│          ├── logger.py
│          ├── cost_analyzer.py
│          ├── index_recommender.py
│
│
├── database/
│   ├── schema.sql
│   ├── seed.py
│   ├── synthetic_data.py
│
├── tests/
│   ├── test_pipeline.py
│   ├── test_security.py
│   ├── test_ml.py
│
└── benchmarks/
    ├── nl_queries.json
