This directory contains the complete Object-Oriented Programming (OOP) implementation of the FlintDB engine in Python.
This version demonstrates:
- The successful implementation of a full Database → Table → Row → Column structured data model.
- Clean, Pythonic coding practices (PEP 8) with detailed class structures for data models.
- Application of Python's I/O capabilities for high-performance file operations.
This project was developed as a system study focusing on the implementation of:
- Transactional Atomicity: Logic to prevent file corruption during write operations.
- Transparent Data Encryption (TDE): Custom encryption classes for data security.
- Custom Caching: Performance optimization using a built-in file-based cache.
You need Python 3.10+ installed on your system.
- Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
This shows the minimal steps required to initialize the database and store a simple record.
from flintdb import Database
# Initialize the database
db = Database(name="dbname", storage="./data_dir")
# Create a specific table
db.create_table(name="users")
# Access the table
users_table = db.table("users")
# Simple row insertion
users_table.insert({
"user_id": 101,
"firstname": "John",
"lastname": "Doe",
"username": "johndoe",
"email": "john@example.com",
"password": "$2y$12$HrMOTq0IVbCr/lRJ7TeEI.nPYEuZ/aNws1YnLHrxniVNVu5D3k4By",
"created_at": 1763123066,
"is_active": True
})
# Find single row
user = users_table.find_one({
"username": "johndoe"
})
# Find many rows
active_users = users_table.find({
"is_active": True
})
# Access single row column
print(user["firstname"])
# Access row columns
print(dict(user))
# Or
for column, value in user:
print(column, "=", value)
# Delete a row from table
user.delete()
# Delete table from database
users_table.delete()
# Delete entire database data
db.delete()For the full architectural goals and multi-language implementations, please visit the main README.