A simple and intuitive SQLite wrapper library that provides an easy-to-use interface for interacting with SQLite databases, enabling basic CRUD operations without writing raw SQL.
Project description
✨ Simplify your SQLite experience without writing SQL
Overview • Features • Installation • Usage • Testing • License • Contributing
🗒️ Overview
A simple and intuitive SQLite wrapper library for Python that provides an easy-to-use interface for interacting with SQLite Databases. This library allows you to perform basic CRUD ( Create, Read, Update, Delete) operations without having to write raw SQL queries.
✨ Features
- Context Manager Support: Automatically handles database connection and closing.
- CRUD Operations: Easy methods for creating tables, inserting, updating, retrieving, and deleting data.
- No Raw SQL Required: Simplified API for common database operations.
🚀 Installation
This library can be installed via pip( recommended ) or git by cloning the repository and installing it locally.
To install Better SQLite
via git:
git clone https://github.com/ayrun3412/Better-SQlite.git
cd Better-SQLite
pip install .
Via pip:
# pip3 for MacOS & Linux
pip install better-sqlite
📚 Usage
Creating a Table
from better_sqlite import Database
with Database('example.db') as db:
db.create_table("users", {"name": "TEXT", "age": "INTEGER"})
Inserting Data
with Database('example.db') as db:
db.insert("users", {"name": "Alice", "age": 30})
Retrieving Data
with Database('example.db') as db:
user = db.get("users", {"name": "Alice"})
print(user) # Output: {'name': 'Alice', 'age': 30}
Updating Data
with Database('example.db') as db:
db.update("users", {"age": 31}, {"name": "Alice"})
Deleting Data
with Database('example.db') as db:
db.delete("users", {"name": "Alice"})
🧪 Testing
To ensure the functionality of the library, you can run the tests using pytest
.
First, Install pytest
if you haven't already:
pip install pytest
Then run, the tests:
pytest
📝 License
This project is licensed under the MIT License - see the LICENSE for more details
🤝 Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for better_sqlite-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5717c02993619aed05172677d61fbbce56c7d6e09c9cb663df526decea7348b9 |
|
MD5 | 753a0d14744dc2d8538e907be2316fce |
|
BLAKE2b-256 | 2a95523294eae54d88bc77b580ae10e7aa9cc5c51daae8bf3cbfedfe8082d0ce |