Skip to main content

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! 🚀

Release files for codedevdb 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codedevdb 0.3
File Size Uploaded
codedevdb-0.3.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codedevdb 0.3
File Interpreter ABI Platform
codedevdb-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / codedevdb-0.3.tar.gz

Download URL codedevdb-0.3.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e8268bf4fcd0e8633220965098c0b01b93a18c05981c1b22a513ecb8cb63c15
BLAKE2b-256 checksum
How to use checksums
306e0d293f1fab9c3415c6821971d6aee6b4e94b98b862cc2fe2174d2879518e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / codedevdb-0.3-py3-none-any.whl

Download URL codedevdb-0.3-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba47b617961dadb5f155b4fd807d020036f74db8456a7b067cf77b8af546f521
BLAKE2b-256 checksum
How to use checksums
33f41921ee2d01cd940a8ca70ffad621eec30c06a84c03244ccf267780f1aadf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page