Interact with PostgreSQL databases using natural language via a secure, performance-aware CLI
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file natquery-1.0.0.tar.gz.
File metadata
- Download URL: natquery-1.0.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22363a61095374bbb70885ea554385008f900077ca3aa4c6317fea966b7b8c32
|
|
| MD5 |
2f379f7f26a3c1179f94c48060a07bde
|
|
| BLAKE2b-256 |
7de4128846e28633f5df142e482fff5f0343cae7023339e493cff4b298810aca
|
File details
Details for the file natquery-1.0.0-py3-none-any.whl.
File metadata
- Download URL: natquery-1.0.0-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95e1007fc1298a9cd329f3c31aadada5eb3e4881713e5746de75d5b2f8c6daf6
|
|
| MD5 |
30474d783340708e30e8d4962c6f11be
|
|
| BLAKE2b-256 |
47f534369db1ae546c256177720d654b62adf9c41d7e6e1592541dc3fd4d7331
|