Skip to content

saanidhi-git/DBMS-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Database Management Agent (DBMA)

Chat with your database using natural language powered by AI

🌟 Overview

Database Management Agent is an intelligent Streamlit-based application that allows users to interact with SQLite databases using natural language. Powered by Groq AI and LangChain, it converts your questions and commands into optimized SQL queries, eliminating the need to write SQL manually.

Whether you want to query data, insert records, update information, or analyze your databaseβ€”just ask in plain English and let the AI handle the rest!


✨ Key Features featuring strong unique solutions

πŸ’¬ Natural Language Interface

  • Ask questions in plain English instead of writing SQL
  • Get instant answers from your database
  • No SQL knowledge required

πŸ—‚οΈ Flexible Database Management

  • Create new databases instantly with a simple name
  • Upload existing .db files directly from your laptop
  • Support for .db, .sqlite, and .sqlite3 formats

πŸ”„ Full Database Operations

  • SELECT - Query and retrieve data
  • INSERT - Add new records
  • UPDATE - Modify existing data
  • DELETE - Remove records
  • ALTER - Modify table structures
  • CREATE/DROP - Table management

πŸ’Ύ Data Export

  • Download updated databases with all changes
  • Export your modified database back to your computer
  • Preserve all AI-made modifications

πŸ“¦ Installation

1. Clone or Download the Project

git clone https://github.com/yourusername/dbma.git
cd dbma

2. Create Virtual Environment

python -m venv .venv
.venv\Scripts\activate  # On Windows
source .venv/bin/activate  # On macOS/Linux

3. Install Dependencies

pip install -r requirements.txt

4. Setup Ollama (Required for AI)

  • Download and install Ollama
  • Pull the DeepSeek model:
ollama pull deepseek-v3.1:671b-cloud
  • Start Ollama server (usually runs on port 11434)

5. Configure Environment

Create a .env file (optional):

# Add any configuration here if needed

πŸš€ Quick Start

Run the Application

streamlit run app.py

The app opens at http://localhost:8501

Basic Workflow

Step 1: Set up Database

  • Choose "Create New Database" or "Load Existing Database"
  • If creating: Enter a database name
  • If loading: Upload your .db file

Step 2: Ask Questions

  • Type your query in the chat box
  • Examples:
    • "Show me all students"
    • "How many records do we have?"
    • "Add a new student named John"
    • "Update the age for user 5"
    • "Delete records older than 2020"

Step 3: Download Results

  • After making changes, click "⬇️ Download Database"
  • Your updated database is ready to use!

πŸ“ Usage Examples

Querying Data

User: "Show me the top 5 students with highest grades"
Agent: Creates SELECT query, retrieves and displays results

Adding Data

User: "Add a new student named Alice, age 20, grade A"
Agent: Constructs INSERT query, adds record, confirms operation

Updating Data

User: "Update John's grade to B+"
Agent: Finds John, updates grade, shows affected rows

Analysis

User: "How many students are in each class?"
Agent: Creates GROUP BY query, displays summary

πŸ—οΈ Project Structure

dbma/
β”œβ”€β”€ app.py                 # Main Streamlit application
β”œβ”€β”€ main.py               # CLI version of the agent
β”œβ”€β”€ main.ipynb            # Jupyter notebook for experimentation
β”œβ”€β”€ requirements.txt      # Python dependencies
β”œβ”€β”€ .env                  # Environment variables (optional)
β”œβ”€β”€ README.md             # This file
β”œβ”€β”€ databases/            # Created databases stored here
β”œβ”€β”€ temp/                 # Uploaded databases stored here
└── .venv/                # Virtual environment

βš™οΈ Configuration

Model Selection

To use a different AI model, edit line 94 in app.py:

llm = ChatOllama(model="your-model-name", temperature=0)

Available Ollama models: ollama.ai/library

Result Limit

Change default result limit in system prompt (currently 5 rows)

Session Thread ID

Modify in app.py for multi-user scenarios:

st.session_state.config = {"configurable": {"thread_id": "unique_id"}}

🎯 Use Cases

✨ Data Analysis - Quickly query and analyze database content
πŸ“Š Data Management - Insert, update, and manage records without SQL
πŸ” Database Exploration - Understand database structure and content
πŸ“± Rapid Prototyping - Quickly test database operations
πŸŽ“ Learning - Great tool for beginners to learn databases
πŸš€ Business Intelligence - Extract insights from data easily


If you find DBMA useful, please star this repository! Your support motivates continued development.

Made with ❀️ for database lovers everywhere


πŸ”— Quick Links


Last Updated: March 2026

About

**DBMS Agent** is an intelligent Streamlit-based application that allows users to interact with SQLite databases using natural language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors