Skip to main content

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

Better SQLite Logo


✨ Simplify your SQLite experience without writing SQL

OverviewFeaturesInstallationUsageTestingLicenseContributing

🗒️ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better_sqlite-0.1.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

better_sqlite-0.1.0-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page