Skip to main content

MySQL storage plugin for PyConfBox

Project description

PyConfBox MySQL Plugin

MySQL database storage backend for PyConfBox

This plugin provides MySQL database storage backend for PyConfBox, enabling persistent configuration storage with full MySQL feature support.

한국어 문서: README_ko.md | English Documentation: README.md (current)

🚀 Installation

pip install pyconfbox-mysql

📋 Requirements

  • Python 3.8+
  • pyconfbox >= 0.1.0
  • PyMySQL >= 1.0.0 or mysql-connector-python >= 8.0.0

💡 Usage

Basic Usage

from pyconfbox_mysql import MySQLStorage
from pyconfbox import Config

# MySQL storage configuration
mysql_storage = MySQLStorage(
    host='localhost',
    port=3306,
    user='root',
    password='password',
    database='config_db'
)

config = Config(default_storage=mysql_storage)

# Store and retrieve configurations
config.set('app_name', 'MyApp')
config.set('debug', True)
config.set('max_connections', 100)

app_name = config.get('app_name')
debug_mode = config.get('debug')

Connection String Usage

from pyconfbox_mysql import MySQLStorage

# Using connection string
mysql_storage = MySQLStorage(
    connection_string='mysql://user:password@localhost:3306/config_db'
)

config = Config(default_storage=mysql_storage)

Advanced Configuration

from pyconfbox_mysql import MySQLStorage

mysql_storage = MySQLStorage(
    host='localhost',
    port=3306,
    user='config_user',
    password='secure_password',
    database='app_config',
    table_name='configurations',  # Custom table name
    pool_size=10,  # Connection pool size
    pool_timeout=30,  # Pool timeout in seconds
    ssl_config={  # SSL configuration
        'ssl_ca': '/path/to/ca.pem',
        'ssl_cert': '/path/to/client-cert.pem',
        'ssl_key': '/path/to/client-key.pem'
    }
)

config = Config(default_storage=mysql_storage)

🎯 Features

  • 🔄 Full CRUD Operations: Create, read, update, delete configurations
  • 🔒 Transaction Support: ACID-compliant transactions
  • ⚡ Connection Pooling: Efficient connection management
  • 🛡️ SSL Support: Secure connections with SSL/TLS
  • 📊 Metadata Tracking: Configuration metadata and timestamps
  • 🔍 Query Optimization: Efficient indexing and query performance

🏗️ Database Schema

The plugin automatically creates the following table structure:

CREATE TABLE configurations (
    id INT AUTO_INCREMENT PRIMARY KEY,
    config_key VARCHAR(255) NOT NULL UNIQUE,
    config_value TEXT,
    data_type VARCHAR(50),
    scope VARCHAR(50),
    is_immutable BOOLEAN DEFAULT FALSE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_config_key (config_key),
    INDEX idx_scope (scope)
);

🔧 Configuration Options

Parameter Type Default Description
host str 'localhost' MySQL server host
port int 3306 MySQL server port
user str Required Database username
password str Required Database password
database str Required Database name
table_name str 'configurations' Table name for storing configs
connection_string str None Complete connection string
pool_size int 5 Connection pool size
pool_timeout int 30 Pool timeout in seconds
ssl_config dict None SSL configuration dictionary

📖 Documentation

🔗 Related Packages

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.

📄 License

MIT License - See the LICENSE file for details.


Power your configurations with MySQL reliability! 🚀

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

pyconfbox_mysql-0.1.1.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

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

pyconfbox_mysql-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pyconfbox_mysql-0.1.1.tar.gz.

File metadata

  • Download URL: pyconfbox_mysql-0.1.1.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pyconfbox_mysql-0.1.1.tar.gz
Algorithm Hash digest
SHA256 521da332394eaf466e71d2769a0b9ee8ba439fd5a8b92d22d1c36fc294d3e26d
MD5 f4050fb0a77861253775910d00147e8b
BLAKE2b-256 14d845e89e808318779d6f6e192d08bd37aeae7db99c581ed4e618b4daf83fbb

See more details on using hashes here.

File details

Details for the file pyconfbox_mysql-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyconfbox_mysql-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3693f3c34b9cb6617a278d4f138d842321a411be8ea74982f75877dafa42b5ab
MD5 857897c2a427b2f4947d8dd85e481c18
BLAKE2b-256 43d1623f5b317976014c2b89ab9d52a346c6543af466ddfc0e8976045856b5d7

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