Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

natquery-1.0.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

natquery-1.0.1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file natquery-1.0.1.tar.gz.

File metadata

  • Download URL: natquery-1.0.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for natquery-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a10cba24d6be80c453952d07b1e6d6d55fdf4cc179518cb1e44ce24fa5f7c64e
MD5 107c45b203ec1dec413b0cd4baa2080b
BLAKE2b-256 3763311cf6c13e1ba0f153e93073a1a06b9a1eaf7b840ed50f5cdc7736cb6431

See more details on using hashes here.

File details

Details for the file natquery-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: natquery-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for natquery-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1cf68b068e46e73c1e2a8a3c64cc3b13c1c7dc3ada8650d1b68e3e391ac8f5f8
MD5 4d1990faf7ad89779c424c287ef2590e
BLAKE2b-256 ef34f91c430e44310d09e08e049f89756ae1fb6219064a3333a271068d3b3c0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page