SmileyDB3 is a library built on sqlite3 to make working with databases easier
Project description
SmileyDB3
SmileyDB3 simplifies database interactions by providing an intuitive and feature-rich interface for SQLite3. Whether you're working with single records, multiple records, or advanced filtering, SmileyDB3 makes your database operations effortless.
Support My Work 💖 If you find SmileyDB3 helpful, consider supporting my work on Ko-fi. Your support helps me maintain and improve this project. Thank you! 🙌
Features
- Dynamic Schema Creation: Automatically generates table schema based on provided data types.
- Record Management: Insert single or multiple records, update, fetch, and delete with ease.
- Filtering Capabilities: Apply advanced filters such as
greater_than,less_than,between, and more. - Export Data: Export table data to a JSON file for external use.
- Indexing: Add indexes to columns for optimized query performance.
- Security: Built-in sanitization to protect against SQL injection and XSS attacks.
Installation
Install SmileyDB3 using pip:
pip install SmileyDB3
Quick Start Guide
1. Create and Initialize a Table
import sqlite3
from smileydb3 import Table
# Connect to SQLite database
db = sqlite3.connect('my_database.db')
cursor = db.cursor()
# Initialize a table
users = Table('users', db, cursor)
# Define and insert data
data = {'name': 'Alice', 'age': 25, 'email': 'alice@example.com'}
users.Insert(data)
2. Insert Multiple Records
data_list = [
{'name': 'Bob', 'age': 30, 'email': 'bob@example.com'},
{'name': 'Charlie', 'age': 28, 'email': 'charlie@example.com'}
]
users.InsertMany(data_list)
3. Fetch All Records
all_users = users.GetALL()
print(all_users)
4. Filter Records
filters = {'age': {'greater_equal': 25, 'less_than': 30}}
filtered_users = users.Filter(filters)
print(filtered_users)
5. Export to JSON
users.ExportToJSON('users_data.json')
6. Update a Record
uuid = 'some-uuid'
updated_data = {'name': 'Alice Smith'}
users.Update(uuid, updated_data)
7. Delete a Record
users.Delete(uuid)
Additional Features
- Dynamic UUID and Timestamp: Automatically adds
uuidandcreated_atfields to each record. - Pandas Integration: Seamlessly use Pandas for data analysis by converting fetched data into DataFrames (easily extendable).
- Logging: Comprehensive logging for debugging and monitoring.
Contributing
We welcome contributions! If you have ideas, suggestions, or bug reports, feel free to open an issue or create a pull request on GitHub.
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SmileyDB3-0.3.7-py3-none-any.whl.
File metadata
- Download URL: SmileyDB3-0.3.7-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
914ad89dde49d8ff299a099fc2622d5d5aa6ac49680f218e58be262ab4a08b94
|
|
| MD5 |
29363e1b557c16efe6a9adc37f4f2357
|
|
| BLAKE2b-256 |
b98968140b79aebde2817c4fb3cc569e290f9ba0fdcab4ee3f0f3a78faf64cde
|