Skip to content

Conversation

@kriti20041
Copy link

Summary

This PR enhances the Text-to-SQL analytics pipeline by adding safety and interpretability layers on top of LLM-generated SQL queries.

Changes

  • Added SQL safety validation to detect and block destructive queries (e.g., DROP, DELETE, UPDATE) before execution.
  • Implemented query intent classification to distinguish aggregation queries from row-level analytics.
  • Improved overall reliability and control of LLM-driven database interactions.

Motivation

LLM-generated SQL can be unsafe and difficult to interpret in production environments.
These changes introduce guardrails and reasoning layers to ensure secure, read-only execution and better understanding of user analytics intent.

Impact

  • Prevents execution of destructive SQL statements
  • Improves transparency of generated queries
  • Makes the Text-to-SQL system more production-ready

Testing

  • Manually tested with sample natural language queries
  • Verified unsafe SQL queries are correctly blocked
  • Confirmed intent classification for aggregation and row-level queries

Updated project description and usage instructions in README.md.
Refactor OpenAI API key handling and improve SQL safety checks. Update Gradio UI for better user experience.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant