Skip to main content

A library dedicated to easy and seamless handling of sqlite3 / db files

Project description

codedevdb Library

PyPI - Version PyPI - Downloads PyPI - LicensePyPI - Python Version

codedevdb is a powerful and easy-to-use Python library for managing SQLite databases. It provides a clean and intuitive interface for database operations, including connection management, query execution, table creation, data insertion, updating, deletion, and more. The library is designed to simplify database interactions while maintaining flexibility and efficiency.


🚀 Features

  • Simple SQLite Database Management: Easily connect to and manage SQLite databases.
  • Context Manager for Connection Handling: Automatically handles database connections and transactions.
  • CRUD Operations: Create, Read, Update, and Delete data with simple methods.
  • Table Management: Create, modify, and drop tables with ease.
  • Bulk Insertion: Insert multiple records in a single operation.
  • Index Creation: Improve query performance with custom indexes.
  • Backup and Restore: Backup and restore your database with a single method.
  • Schema Inspection: Retrieve table schema information.
  • Error Handling: Robust error handling with rollback support.

📦 Installation

You can install codedevdb via pip:

pip install codedevdb

🔥 Usage

Importing the Library

import codedevdb

Connecting to a Database

# Connect to a SQLite database (or create it if it doesn't exist)
db = codedevdb('mydatabase.db')

Creating a Table

# Create a table with columns
db.create('users', id='INTEGER PRIMARY KEY', name='TEXT NOT NULL', age='INTEGER')

Inserting Data

# Insert a single record
db.insert('users', name='John', age=30)

# Insert multiple records
data = [
    {'name': 'Alice', 'age': 25},
    {'name': 'Bob', 'age': 28}
]
db.insert_bulk('users', data)

Fetching Data

# Fetch all records from the table
result = db.select('users')
print(result)

# Fetch specific columns with a condition
result = db.select('users', where="age > 25", columns=['name', 'age'])
print(result)

Updating Data

# Update records
db.update('users', where="name = 'John'", age=31)

Deleting Data

# Delete records
db.delete('users', where="name = 'John'")

Counting Records

# Count records
count = db.count('users', where="age > 25")
print(f"Number of users above 25: {count}")

Checking if Records Exist

# Check if a record exists
exists = db.exists('users', where="name = 'Alice'")
print(f"Does Alice exist? {exists}")

Dropping a Table

# Drop a table
db.drop_table('users')

Truncating a Table

# Truncate a table (delete all records)
db.truncate('users')

Inspecting Table Schema

# Get table schema
schema = db.schema('users')
print(schema)

Creating an Index

# Create an index on a column
db.create_index('users', 'idx_name', ['name'])

Backup and Restore

# Backup the database
db.backup('backup.db')

# Restore the database
db.restore('backup.db')

🌍 Compatibility

  • Python: 3.8+
  • Databases: SQLite3

🎯 Contribution

We welcome contributions! If you'd like to contribute to CodeDevDB, please open an issue or submit a pull request on GitHub.


📄 License

CodeDevDB is released under the MIT License.


📞 Contact

For any questions or support, feel free to reach out:


Best Regards ♡

Thank you for using CodeDevDB! We hope it simplifies your database management tasks and makes your development process smoother. If you have any feedback or suggestions, please don't hesitate to reach out. Happy coding! 🚀

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

codedevdb-0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codedevdb-0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file codedevdb-0.2.tar.gz.

File metadata

  • Download URL: codedevdb-0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for codedevdb-0.2.tar.gz
Algorithm Hash digest
SHA256 9956eba03d7eeb77f65ac1f75afebd5fad2a89ac65ebfe2d3629d67ea66f7e80
MD5 1af3e2e5c65a90ef224bd677910424af
BLAKE2b-256 1048fb3f0f18ec0481624d586596cc84ffe9396500375d60830cb0a609abc6cb

See more details on using hashes here.

File details

Details for the file codedevdb-0.2-py3-none-any.whl.

File metadata

  • Download URL: codedevdb-0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for codedevdb-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f53972bcca4b1716aa0dbd542942c279e2a6ea4e984cb71be8b430860078c209
MD5 66c10044d3a6c68cf9644a56c0927861
BLAKE2b-256 23b25c843ef29e68d54836ae6935b60c42fc2c5fd74f657a4bfc992c50ca897b

See more details on using hashes here.

Supported by

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