Inspiration
We were inspired by the growing need for non-technical users to access data insights without having to write complex queries. While SQL works great for structured data, many modern datasets are better represented as graphs. This project aims to remove the barrier by allowing users to ask questions in plain English and get answers from both relational and graph databases seamlessly.
What it does
- Converts natural language questions into SQL queries for relational databases.
- Converts natural language questions into Cypher queries for Neo4j graph databases.
- Automatically runs the queries and returns results in a simple, interactive streamlit web app.
- Provides a unified interface to explore data across different data models.
How we built it
- Frontend: Built with Streamlit for real-time interaction.
- Backend: Python with
- SQLAlchemy for relational database connectivity (demo: SQLite).
- Neo4j Python driver for graph database connectivity.
- SQLAlchemy for relational database connectivity (demo: SQLite).
- AI layer: Large Language Models (LLMs) were used to convert natural language into structured queries.
- Query routing system: Designed to decide whether a question should be answered via SQL or Cypher.
Challenges we ran into
- Ambiguous user queries that could map to both SQL and graph queries.
- Neo4j setup and debugging issues (e.g., functions like
RELATIONSHIPS()not supported in Cypher). - Virtual environment conflicts with
streamlitandneo4jdependencies. - Making sure the generated queries were safe, not producing invalid SQL or Cypher.
Accomplishments that we're proud of
- Successfully integrating two different database backends** (SQL + Neo4j) into one application.
- Creating a tool where even a non-technical business analyst can query complex datasets with plain English.
- Building a modular design that can easily plug into other relational or graph databases.
What we learned
- The fundamental differences between relational data modeling and graph-based modeling.
- How to structure LLM-powered chains to produce correct SQL and Cypher queries.
- Techniques for validating AI-generated queries before execution.
- Best practices in combining multiple backends in a unified interface.
What's next for Text-to-SQL & Text-to-Cypher Web App
- Adding support for more databases (e.g., PostgreSQL, MongoDB, ArangoDB).
- Improving query understanding with context-aware AI chains.
- Integrating visualization features (graph plots, charts, dashboards) directly in the app.
- Deploying the app on the cloud so it can be used by anyone, anywhere.
- Enhancing query safety with robust validation and sandboxing mechanisms.
Log in or sign up for Devpost to join the conversation.