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 - License

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.3.tar.gz (5.6 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.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for codedevdb-0.3.tar.gz
Algorithm Hash digest
SHA256 1e8268bf4fcd0e8633220965098c0b01b93a18c05981c1b22a513ecb8cb63c15
MD5 59b5e79bda430327ab90ed45e91427f6
BLAKE2b-256 306e0d293f1fab9c3415c6821971d6aee6b4e94b98b862cc2fe2174d2879518e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codedevdb-0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ba47b617961dadb5f155b4fd807d020036f74db8456a7b067cf77b8af546f521
MD5 2e9155d3b89e138c061fa4599122a297
BLAKE2b-256 33f41921ee2d01cd940a8ca70ffad621eec30c06a84c03244ccf267780f1aadf

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