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
File details
Details for the file better_sqlite-0.1.0.tar.gz
.
File metadata
- Download URL: better_sqlite-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2745343e5b7a8d79f0175cc0ed96a96d29b9464b6ccfe2ac8c6823d44d04ac1 |
|
MD5 | 7204a1af6683037a84d00f5fc74987b8 |
|
BLAKE2b-256 | bf2f79a496b7c4d54357f818228bc56b98aeda29ac2cbef3c5e495b4e08c01dd |
File details
Details for the file better_sqlite-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: better_sqlite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5717c02993619aed05172677d61fbbce56c7d6e09c9cb663df526decea7348b9 |
|
MD5 | 753a0d14744dc2d8538e907be2316fce |
|
BLAKE2b-256 | 2a95523294eae54d88bc77b580ae10e7aa9cc5c51daae8bf3cbfedfe8082d0ce |