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
- pyconfbox - Main PyConfBox package
- pyconfbox-django - Django integration
- pyconfbox-postgresql - PostgreSQL storage backend
- pyconfbox-mongodb - MongoDB storage backend
🤝 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyconfbox_mysql-0.1.2.tar.gz.
File metadata
- Download URL: pyconfbox_mysql-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f561fcaca716d232ad5f099c18aa795ef54cbd37d4b6ac2ab1bae7ab24538340
|
|
| MD5 |
5227772bcaad2a9bc20f2c156303876f
|
|
| BLAKE2b-256 |
b09f43a659f764aa0ddf29e22c0dfa1192141645861a678169db9f4d2792d769
|
File details
Details for the file pyconfbox_mysql-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyconfbox_mysql-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdfb71377c6eb43ef49c6bbdc2fb1d344de5cb76aee9a0c199728f0dca502ea5
|
|
| MD5 |
f70d18e67a3e4e4decb4fd7b259b663b
|
|
| BLAKE2b-256 |
c8ba3e444b837ca9af5496d4f4a601a5a6f0dd42fc26dd1923725c885c95d7c4
|