Project Info
Inspiration
As the list of use cases grow for artificial intelligence (AI for short), we thought that it is important to use AI in order to bridge the gap between those who are tech-savvy and those who are non tech-savvy. We were inspired to create this project because we know people that are not knowledgeable in SQL; we know people who are not that knowledgeable in technology that is more on the complicated side. Not everyone is a data scientist. However, a database is an entity that most people often (but do not realize) interact with. In fact, people close to us such as our parents, often are not knowledgeable in SQL. That's where we thought of Databae. Why not just use a language that most people know (in the US) such as English and use that to provide insightful analysis and visualization to the user?
What it does
Let's introduce you to your new friend, Databae. It is your personal AI assistant when it comes to making queries to any database and providing insightful analysis on the dataset. Let's be honest. Not everyone wants to write SQL queries. Not everyone knows SQL. Not everyone knows how to use complicated technologies. That's where Databae comes in. We utilize AI in order to use human language to provide insights on the data in your database. Databae generates a SQL query, double checks the SQL query against the database schema and prompt to make sure that it is a valid query, execute the query, and analyze the result set in order to provide you visualizations (only table form is available for now) about data that exists in your database. We do not just generate SQL queries and execute them. That is boring!!! We provide analysis on your data. Your question does not have to have anything corresponding with an SQL statement. You can perhaps ask, "Which employee in the company is best suited for frontend development?," and Databae will make sure to provide you analysis on that rather than just generating a SQL query and getting the result set.
How we built it
Frontend: Next.js - Basically, the core of our frontend. It displays the front page, connection page, and dashboard. Shadcn/ui - We used certain components from Shadcn/ui such as the buttons. Framer Motion - Do you see the cool animations on our website? Well, Framer Motion allows us to display those cool animations to you. Backend: Python - This is the programming language that powers our backend. FastAPI - FastAPI powers our API endpoints and allows the frontend to request data to display on the frontend. Groq: We utilized Groq's LLaMA models to be able to generate SQL queries, check the SQL queries, and analyze the result set and provide insightful analysis and visualizations. uAgents: We utilized uAgents to create AI agents that are able to communicate with one another. uAgents powers our query generator, query checker, query executor, and query analyzer. AI Agents (part of our backend): Query Generator: The query generator receive the user's request, utilizing the LLaMA model to process the user's prompt, understand and determining if a tool is need or not. If an SQL query and AI tool is needed, it will send the query to the Query Checker. If not, the workflow stops there and it will provide the user with general knowledge related to the database or its schemas. Query Checker: The query checker checks whether the SQL query generated abides by the database schema and user's prompt. If the query checker approves of the SQL query, it will forward the query to the query executor. Otherwise, it will notify the user that the query generated cannot be executed due to the query being too vague or unrelated. Query Executor: The query executor executes the query, gets the dataset from the query, and forwards the dataset to the query analyzer along with the database schema and prompt. Query Analyzer: The query analyzer analyzes the result set, gives insightful results and visualizes the results in a clear and concise manner accordingly to the user's request.
Challenges we ran into
As our frontend has a lot of animations and other cool elements to it, it took a long time to be able to perfect and optimize the appearance of our frontend. Being able to finetune and prompt engineer the LLM models in order to provide the appropriate responses. We had to make lots of adjustments in the prompts in order for it to provide good analysis of the data. We had to figure out how to properly translate the LLM's response into a proper Pandas DataFrame (basically the table). Handling multi-agent communication in uAgents was also a struggle as we had to figure out how to make one agent talk to another that talks to another and vice versa.
Accomplishments we're proud of
We are proud of being able to utilize Fetch.AI's AI agents in order to satisfy our workflow of generating a SQL query => checking the SQL query => executing the SQL query => analyzing the SQL query and providing proper visualizations. We are also proud of being able to use Groq's extremely fast LLMs in order to quickly provide quality but fast analysis of the data in the database. Our frontend was also an important aspect. We used many libraries in order to optimize and "perfect" the appearance of our website. It took us a long time to design the website in the first place.
What we learned
We learned about new amazing frameworks such as Fetch.AI's AI agents. With the assistance of many mentors in CalHacks, we were able to learn a lot about new technologies and techniques We also learned about Groq's LLMs; those were vital in providing those ultra quick responses to the user, and we see many other possible use cases for it.
What's next
More tools: We intend to create more tools for Databae. Our application was designed to have many more tools such as a pie chart generator, prediction models, and other tools. For our use case, we decided to only generate our visualizations in table form, but it is able to scale up in order to be able to display it in many more forms such as pie charts, bar charts, etc. Cross database analysis: What if you want to analyze multiple databases and make correlations between multiple databases? We want to add this functionality. Integration with more databases: We want to be able to have Databae be able to be integrated into more databases such as PostgreSQL, MongoDB, and other DBs. Finetuning the prompts: We want to finetune the prompts in order to provide more insightful responses and visualizations.
Databae - Cal Hacks 11.0
What is Databae?
- Have you ever had to create an SQL query by hand? You're probably saying, "Do not make me do that!" Well, Databae comes to the rescue!
- Databae is your personal AI assistant when it comes to exploring the complexities of an SQL database. Tell Databae what you want to query your database in plain English, and Databae will automatically query the database and visualize the results for you to understand.
Diagram
Instructions
Frontend
- Install npm
- Change directory into the folder
frontendand runnpm installto install all the dependencies - Run the command
npm run dev
Backend
- Install Python (minimum version 3.10)
- Install Poetry & Pipx.
- Run
poetry shellandpoetry install - Make a .env file consisting to store the Groq API key
GROQ_API_KEY=GRAB YOUR API KEY FROM GROQ - For backend, open up two terminals. Change into the directory folder
backendand runuvicorn server:app --reloadon terminal 1 and runpython agents.pyon terminal 2. Depending on your operating system, it could be python or python3.
Use Cases
- Connect to any MySQL database to visualize data
- Generate a pie chart based off data in the database
- Generate a table based off data in the database
- Generate a plaintext response based off data in the database
Audience
Anyone, whether SQL wizards or not, can use it. Type in plain English, and we generate the queries and visualize the data for you.
- Are you in the medical industry? Do you want to visualize the amount of usage of medication A within each age group? Tell Databae!
- Are you in the education industry? Do you want to know the grades of every student? Tell Databae!
- Are you in the music industry? Do you want to make a pie chart that visualizes how many tracks each artist has created? Tell Databae!
Analysis
View
Metric
- 10
- 9
- 7
- 4
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- Next.jsIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
7 of 7 appear in the indexed code.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
85 KB
Source files
30
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
trungtran1234/databae
46 files · 866 KB · @ eb870c6
Structure
Interface
14 files · 30%Screens, components and styles rendered to the user.
Application logic
13 files · 28%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python57%
- TypeScript39%
- Markdown4%
- CSS0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
frontend/package.json
npm · 23- @radix-ui/react-slot
- class-variance-authority
- clsx
- framer-motion
- html-react-parser
- ldrs
- lucide-react
- next
- react
- react-dom
- react-markdown
- tailwind-merge
- tailwindcss-animate
- +10 more
backend/pyproject.toml
pypi · 9- fastapi
- groq
- instructor
- mysql-connector-python
- pandas
- pydantic
- python-dotenv
- uagents
- uvicorn
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
Feature verification
AI-generated analysis/visualization of result set (table form)Verified
Databae analyzes the result set and provides table-form visualizations of the data
Claimed on readmehigh confidencebackend/agent_funcs.py:286— generate_table() extracts structured data via LLM and converts it to a pandas DataFrame HTML table (df.to_html)backend/agents.py:142— query_analyzer_agent calls generate_table and writes the resulting HTML table to response.txtfrontend/src/Components/DataConnection/DatabaseConnection.tsx:41— FormTable component renders the returned HTML table response in the dashboard UI
Connect to a MySQL database via connection formVerified
Connect to any MySQL database to visualize data
Claimed on readmehigh confidencebackend/db_tools.py:44— check_and_add_db_credentials uses mysql.connector.connect and persists credentials to db_credentials.jsonbackend/server.py:93— /input_connection_details endpoint accepts host/user/password/port/db_name and calls check_and_add_db_credentialsfrontend/src/Components/DataConnection/DatabaseConnection.tsx:44— Connection form posts host/username/password/port/databaseName to /input_connection_details
FastAPI backend API endpointsVerified
FastAPI powers our API endpoints and allows the frontend to request data
Claimed on Devposthigh confidencebackend/server.py:16— FastAPI app defined with /endpoint, /input_connection_details, /status routes plus CORS middleware for the frontend
Framer Motion animations on frontendVerified
Framer Motion allows us to display cool animations on the website
Claimed on Devposthigh confidencefrontend/src/Components/DataConnection/DatabaseConnection.tsx:4— imports and uses framer-motion's motion.section/div with spring transitionsfrontend/src/app/dashboard/page.tsx:4— motion.div/motion.h1 animated floating circles and fade-ins on dashboard
Groq LLaMA models power query generation/checking/analysisVerified
We utilized Groq's LLaMA models to be able to generate SQL queries, check the SQL queries, and analyze the result set
Claimed on Devposthigh confidencebackend/agent_funcs.py:12— ROUTING_MODEL/TOOL_USE_MODEL/GENERAL_MODEL set to llama3-70b-8192 / llama3-groq-70b-8192-tool-use-preview, used via Groq client throughout the file
Multi-agent pipeline via Fetch.ai uAgents (generator → checker → executor → analyzer)Verified
uAgents powers our query generator, query checker, query executor, and query analyzer, which communicate with one another
Claimed on Devposthigh confidencebackend/agents.py:11— Four separate uagents.Agent instances (generator, checker, executor, analyzer) defined and chained via ctx.send calls, bundled in a Bureaubackend/agent_class.py:4— Request/Response uAgents Model classes used to pass messages between agents
Natural language to SQL query generationVerified
Databae generates a SQL query from the user's plain-English question
Claimed on readmehigh confidencebackend/agent_funcs.py:74— create_db_query() sends the user query and schema to Groq's model with SQL_CREATOR_INSTRUCTION to produce a SQL querybackend/instructions.py:1— SQL_CREATOR_INSTRUCTION defines the SQL-generation persona/instructions
Next.js frontend with front page, connection page, dashboardVerified
Next.js is the core of our frontend, displaying the front page, connection page, and dashboard
Claimed on Devposthigh confidencefrontend/src/app/page.tsx:1— Front page routefrontend/src/app/dashboard/page.tsx:1— Dashboard page route rendering DatabaseVisualizerfrontend/src/Components/DataConnection/DatabaseConnection.tsx:1— Connection page component used within the app
Non-SQL / general natural-language responses about the schemaVerified
Question does not have to correspond to an SQL statement; Databae can respond with general knowledge about the schema instead of just generating a query
Claimed on Devposthigh confidencebackend/agent_funcs.py:30— route_query() classifies whether a DB query is needed ('TOOL: DB_QUERY') or notbackend/agent_funcs.py:62— run_general() answers the query using only the schema and user query when no DB query is neededbackend/agents.py:53— query_generator_agent sends the general response straight back to the user when route != 'db query needed'
Pandas DataFrame for result processing/tablesVerified
We had to figure out how to properly translate the LLM's response into a proper Pandas DataFrame
Claimed on Devposthigh confidencebackend/agent_funcs.py:294— pd.DataFrame(structured_data) constructed and converted to HTML table
Shadcn/ui components (e.g., buttons)Verified
We used certain components from Shadcn/ui such as the buttons
Claimed on Devpostmedium confidencefrontend/src/Components/ui/button.tsx:1— shadcn-style button component presentfrontend/src/Components/ui/card.tsx:1— shadcn-style card component present, used in dashboard
SQL query execution against connected databaseVerified
Databae executes the generated query
Claimed on Devposthigh confidencebackend/agent_funcs.py:129— execute_query() opens a DB connection, runs cursor.execute(query), and returns resultsbackend/agents.py:117— query_executor_agent handler invokes execute_query and forwards results to the analyzer agent
SQL query validation against schema/prompt (query checker)Verified
Databae double checks the SQL query against the database schema and prompt to make sure it is valid
Claimed on Devposthigh confidencebackend/agent_funcs.py:115— check_query() sends the SQL, schema, and user query to Groq with CHECKER_INSTRUCTION and returns pass/failbackend/agents.py:80— query_checker_agent handler calls check_query and routes to executor only if 'QUERY CHECKER PASSED'
Cross-database analysis/correlationClaimed only
What if you want to analyze multiple databases and make correlations between multiple databases? We want to add this functionality (What's next)
Claimed on Devposthigh confidenceGCP / Google Cloud integrationClaimed only
Built with gcp, google
Claimed on Devpostmedium confidencePie chart generation toolClaimed only
Generate a pie chart based off data in the database (README use case) / future pie chart tool (Devpost 'what's next')
Claimed on readmehigh confidenceSupport for PostgreSQL, MongoDB, and other databases beyond MySQLClaimed only
We want to be able to have Databae be able to be integrated into more databases such as PostgreSQL, MongoDB, and other DBs (What's next)
Claimed on Devposthigh confidence
An AI agent derived these features from the project’s Devpost page and readme, then searched the code for each one. Verified features are backed by cited code; claimed-only features had no supporting code, which is not by itself proof a feature is missing.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.