From 395570cffd67980434fce19ca664c6d6d4ff93b6 Mon Sep 17 00:00:00 2001 From: Mitesh Choksi Date: Fri, 16 May 2025 19:27:36 +0300 Subject: [PATCH 1/2] style: Update README.md --- README.md | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 118 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f3d688e..ba8b6c9 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,125 @@ -## MySQLClient for Frappe v15 +# MySQLClient for Frappe v15 +**App Name:** `mysqlclient_v15` +**App Title:** MySQLClient for v15 +**Publisher:** Resilient Tech +**Email:** info@resilient.tech +**License:** MIT -#### Setting up +A custom Frappe app that overrides the default MariaDB database connection logic to enable the use of the `mysqlclient` Python package on Frappe v15. + +--- + +## 🔧 What It Does + +This app overrides `frappe.database.get_db()` to conditionally use a custom `MariaDBDatabase` class from `mysqlclient_v15.mysqlclient`. This is activated based on the `use_mysqlclient` flag in `site_config.json`. + +Supports dynamic selection between: +- PostgreSQL +- Standard MariaDB +- MariaDB via `mysqlclient` (this app) + +--- + +## ✅ Why Use This + +- Improved compatibility with `mysqlclient` +- Performance optimization in specific environments +- Clean modular override approach for Frappe v15 + +--- + +## ⚠️ Risks & Considerations + +- Must maintain compatibility with Frappe DB interface +- May conflict with future Frappe updates +- Affects all database operations globally +- Requires proper configuration in `site_config.json` + +--- + +## 🚀 Setup Instructions + +### 1. Install the App +```bash +bench get-app mysqlclient_v15 +bench --site your-site install-app mysqlclient_v15 +```` + +### 2. Enable in `site_config.json` + +```json +{ + "db_type": "mariadb", + "use_mysqlclient": 1 +} +``` + +### 3. Ensure the override is active + +In your `__init__.py` or `hooks.py`: + +```python +from frappe import database +from mysqlclient_v15.custom_db import get_db + +database.get_db = get_db +``` + +### 4. Restart Bench + +```bash +bench restart +``` + +--- + +## 🔄 How to Disable + +1. Set the flag to false or remove it from `site_config.json`: + +```json +"use_mysqlclient": 0 +``` + +2. Comment or remove the override: + +```python +# database.get_db = get_db +``` + +3. Restart: + +```bash +bench restart +``` + +4. (Optional) Uninstall the app: + +```bash +bench --site your-site uninstall-app mysqlclient_v15 +``` + +--- + +## 📦 App Structure + +This app follows standard Frappe app conventions and can be extended with: + +* Custom permissions +* Notifications +* Page/Doctype hooks +* Integration events + +--- + +## 📧 Support + +For support, contact: [info@resilient.tech](mailto:info@resilient.tech) + +--- -1. If you're not on Frappe Cloud, install the relevant [dependencies](https://github.com/PyMySQL/mysqlclient?tab=readme-ov-file#install). -1. Install the app -1. Set the `use_mysqlclient` config to `1` (globally or on specific sites): - ```sh - bench set-config -g use_mysqlclient 1 - ``` 1. Enjoy upto 4x faster database speeds! 🚀 From a8f9e2c897cbf421e35a28455b46a1782293e5c7 Mon Sep 17 00:00:00 2001 From: Mitesh Choksi Date: Fri, 16 May 2025 19:29:14 +0300 Subject: [PATCH 2/2] style: 2nd Update to README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba8b6c9..1a5e728 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ For support, contact: [info@resilient.tech](mailto:info@resilient.tech) -1. Enjoy upto 4x faster database speeds! 🚀 +# Enjoy upto 4x faster database speeds! 🚀 #### Sponsor