How itsashna/nlp-to-sql-queries works
Project type and purpose
• This is a backend “NLP-to-SQL” microservice built with FastAPI, containerized with Docker, deployed on AWS EKS.
• It translates user‐supplied natural language into SQL (via OpenAI GPT), runs that SQL on Amazon Athena against data stored in S3, and returns results as JSON.
File structure
Top-level files and directories:
• .github/workflows/ecr-push.yml → CI/CD workflow that builds & pushes to ECR
• Dockerfile, .dockerignore → containerization
• deployment.yaml, service.yaml → Kubernetes manifests for EKS
• buildspec.yml → optional AWS CodeBuild spec
• nlp-agent/ & nlp_agent/ → Python application code (Athena client, NLP→SQL logic, FastAPI main)
• requirements.txt → Python dependencies
• dataset.py, upload_to_s3.py, *.csv → scripts/data to load Northwind into S3/Athena
Patterns & technologies:
• Microservice/API layer (FastAPI)
• Container registry (ECR) + CI/CD (GitHub Actions)
• Kubernetes orchestration (EKS)
• External services (OpenAI API, Athena, S3)
README for additional insights
• Sequence: User → FastAPI → OpenAI → Athena → S3 → FastAPI Response
• CI/CD: GitHub Actions triggers on push to main, builds Docker image, pushes to ECR
• Deployment: Kubernetes manifests create Deployment, Service, Load Balancer on EKS
• Security: API keys managed via Kubernetes secrets / config
Detail
• Don’t just show “Backend” – break it into “FastAPI application” + “NLP→SQL module” + “Athena client.”
• Separate CI/CD pipeline into “Build” vs. “Deploy” phases.
• Where Docker images live (ECR) and how they’re consumed by EKS.
• How data files (CSV) get into S3 (via upload_to_s3.py/dataset.py).