Skip to main content

A powerful and flexible database manipulation library that provides a unified interface for multiple database systems.

Project description

RepenseDB 🚀

PyPI version Python Versions License: MIT

A powerful and flexible database manipulation library that provides a unified interface for multiple database systems.

🌟 Features

  • 🔌 Unified connection interface for multiple databases
  • 🔄 Support for MySQL, SQLite, Redis, Firebase, and PostgreSQL
  • 🛠 Factory pattern for easy connection creation
  • 🔐 Secure credential management
  • 🐳 Docker-friendly configuration
  • 📦 Easy integration with existing projects

🚀 Quick Start

Installation

pip install repensedb

or with Poetry:

poetry add repensedb

Basic Usage

from repensedb.connections.factory import ConnectionFactory

# SQLite connection (in-memory)
sqlite_url = "sqlite://:memory:"
sqlite_conn = ConnectionFactory.create(sqlite_url)
sqlite_conn.connect()

# SQLite connection (file-based)
sqlite_file_url = "sqlite:///path/to/database.db"
sqlite_file_conn = ConnectionFactory.create(sqlite_file_url)
sqlite_file_conn.connect()

# MySQL connection
mysql_url = "mysql://user:password@localhost:3306/mydatabase"
mysql_conn = ConnectionFactory.create(mysql_url)
mysql_conn.connect()

# Redis connection
redis_url = "redis://localhost:6379/0"
redis_conn = ConnectionFactory.create(redis_url)
redis_conn.connect()

SQLite Example

from repensedb.connections.sqlite import SQLiteConnection
from repensedb.database.sqlite.manager import SQLiteManager

# Initialize connection and manager
conn = SQLiteConnection(url="sqlite:///myapp.db")
manager = SQLiteManager(conn, "users")

# Create table
columns = """
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    email TEXT UNIQUE,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
"""
manager.create_table(columns)

# Insert data
user = {"name": "John Doe", "email": "john@example.com"}
user_id = manager.insert_record(user)

# Query data
results = manager.select(where="email = ?", params=("john@example.com",))

Firebase Integration

from repensedb.connections.firebase import FirebaseConnection
from repensedb.database.firebase.manager import FirebaseManager

# Initialize with credentials
firebase_conn = FirebaseConnection(credentials_path="path/to/service-account.json")
fb_manager = FirebaseManager(firebase_conn)

# Perform operations
user_data = {"name": "John Doe", "email": "john@example.com"}
doc_id = fb_manager.insert_document("users", data=user_data)

🔧 Supported Databases

  • SQLite (file-based and in-memory)
  • MySQL
  • Redis
  • Firebase
  • PostgreSQL

📚 Documentation

For detailed documentation and examples, visit our documentation page.

🧪 Testing

We use pytest for testing. To run the test suite:

# Install dev dependencies
poetry install --with dev

# Run tests
poetry run pytest

🛠 Development

Prerequisites

  • Python 3.10+
  • Poetry
  • Docker (optional, for local database testing)

Setup Development Environment

# Clone the repository
git clone https://github.com/your-username/repensedb.git
cd repensedb

# Install dependencies
poetry install

# Setup pre-commit hooks
pre-commit install

Code Quality

We maintain high code quality standards using:

  • Black for code formatting
  • Flake8 for linting
  • Pre-commit hooks for consistency

To run code quality checks:

make lint

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with ❤️ by Repense.ai
  • Maintained by Samuel Alessandro Baptista

Made with ❤️ by Repense.ai

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

repensedb-1.1.15.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

repensedb-1.1.15-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file repensedb-1.1.15.tar.gz.

File metadata

  • Download URL: repensedb-1.1.15.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.9 Linux/6.8.0-1021-azure

File hashes

Hashes for repensedb-1.1.15.tar.gz
Algorithm Hash digest
SHA256 029b4dd7eec6971a19cf5c14d39cdc4f3df95c427d35867223c6c120b5d2fcef
MD5 f02afc478b31fd05d3a3aac110eff5ab
BLAKE2b-256 25eccb3519ab32e57b0a94677d23b449013656d86db5bb159d755ae2f071eb18

See more details on using hashes here.

File details

Details for the file repensedb-1.1.15-py3-none-any.whl.

File metadata

  • Download URL: repensedb-1.1.15-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.9 Linux/6.8.0-1021-azure

File hashes

Hashes for repensedb-1.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 4da42e56822e130e9c490b3cb1fb01f5f9f2c620de48f27126533fc8c6fef14c
MD5 ec371f93b036a1c734d6a3eac2716af6
BLAKE2b-256 3bb2f69c57157afbf3ee562e5bd76b46344ecd541fd824d02e6ae1f524896585

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