Skip to content

A lightweight, file-based No-SQL database engine built from scratch in C, designed to handle key-value data with versioning support. Perfect for learning database internals or embedding into resource-constrained environments

Notifications You must be signed in to change notification settings

JoeHitHard/No-SQL-DB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No-SQL Database Engine 🔥

A lightweight, file-based No-SQL database engine built from scratch in C, designed to handle key-value data with versioning support. Perfect for learning database internals or embedding into resource-constrained environments.

C Language Versioning License


🛠 Technologies Used

  • Core Language: C (with stdio.h, stdlib.h, string.h)
  • Data Structures: Custom implementations of hash tables, linked lists, and dynamic arrays.
  • Version Control: Column-level versioning for audit trails.
  • Persistence: Logging operations to log.txt for durability.
  • Memory Management: Manual memory allocation/reallocation with optimizations for scalability.

🚀 Features

  • CRUD Operations: create, put, get, delete tables and records.
  • Schema-less Design: Flexible key-value pairs with dynamic column support.
  • Data Versioning: Track historical changes at the column level (e.g., see previous values of a field).
  • Atomic Transactions: Commit updates safely with version consistency checks.
  • Query Logging: All operations are logged to log.txt with timestamps.
  • Lightweight: No external dependencies—just compile and run!

🛠 Getting Started

Prerequisites

  • GCC compiler
  • Basic terminal familiarity

Installation

  1. Clone the repo:
    git clone https://github.com/JoeHitHard/No-SQL-DB.git
    cd No-SQL-DB/DB\ Engine
    
  2. Compile the code:
    gcc main.c -o nosql_db
  3. Run the executable:
    ./nosql_db

💻 Usage Examples

Create a Table

create users;

Output: Table "users" has been created.

Insert Data

put users key=joe id=joe1 age=28 email=joe@dev.com;

Output: Row Inserted.

Retrieve Data

get users joe;

Output:

          joe:           id:           joe1 Version: 1
                       age:             28 Version: 1
                     email:   joe@dev.com Version: 1

Delete Data

delete users joe;

Output: Row Deleted.

Advanced Query (Get All Rows)

get users all;

Output: Displays all rows in the users table.


🎯 Use Cases

  1. Configuration Storage: Store app settings with version history.
  2. User Profiles: Manage flexible user attributes without rigid schemas.
  3. IoT Data Logging: Capture sensor readings with timestamps and versions.
  4. Educational Tool: Learn how databases handle CRUD and memory management.

🔮 Future Enhancements

  • Add support for indexes to speed up queries.
  • Implement a rollback command to revert to previous versions.
  • Add network support for remote connections.
  • Support JSON export/import for interoperability.

Star this repo if you love minimalist, performant systems!

About

A lightweight, file-based No-SQL database engine built from scratch in C, designed to handle key-value data with versioning support. Perfect for learning database internals or embedding into resource-constrained environments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages