Skip to main content

Magento Database Management Tool

A powerful Python script to list Magento database tables and perform MySQL dumps with filtering and compression.

Features

✅ Show Table Sizes: Lists only tables larger than 1MB, sorted by size.
✅ Dump Full Database: Dumps all tables, ignoring predefined ones.
✅ Interactive CLI: Select options using an interactive menu.
✅ Progress Tracking: Shows real-time progress during MySQL dump.
✅ Config Auto-Detection: Reads Magento env.php for database settings.
✅ Compression: Dumps are gzip compressed for storage efficiency.

Installation

  1. Clone the Repository
git clone https://github.com/yourusername/magento-db-tool.git
cd magento-db-tool
  1. Install Dependencies
pip install tqdm simple-term-menu

🔹 Run Interactive CLI

python3 magento_db_tool.py

🔹 Show Tables Bigger Than 1MB

python3 magento_db_tool.py show-tables

🔹 Dump Entire Magento Database

python3 magento_db_tool.py db-dump

📝 Commands Overview Command Description

  • show-tables List tables larger than 1MB with row count & size
  • db-dump Dumps all tables with gzip compression
  • exit Close the tool 📦 Example Output Listing Tables

🔍 Fetching table details (only tables > 1MB)...

Table Name                            Rows           Size (MB)  
=================================================================
sales_order                           50000         15.6  
catalog_product_entity                120000        12.3  
customer_entity                        30000         8.4  

✅ Showing 3 tables larger than 1MB. Dumping Database

🚀 Starting database dump...
📂 Dumping table: sales_order ...
📂 Dumping table: catalog_product_entity ...
📂 Dumping table: customer_entity ...

✅ Database dump successful: magento_luma_dump_20240219.sql.gz

🔧 Configuration This tool automatically extracts your Magento database settings from app/etc/env.php. No manual setup required!

Change ignored tables in ignore_tables inside the script. ⏱ Automate with CRON To schedule daily database backups at midnight, add this to crontab -e:

0 0 * * * /usr/bin/python3 /path/to/magento_db_tool.py db-dump

Deploy to PyPI, follow these steps:

1️. Install Twine (if not installed)

pip install twine

2️. Build the Package Inside your project root (magento-dump/):

pip install --upgrade setuptools
python setup.py sdist bdist_wheel

3️. Upload to PyPI

twine upload dist/*

or

rm -rf dist/ && python setup.py sdist bdist_wheel && twine upload dist/*

or new wey:

pip install build
rm -rf dist/*
python -m build
pip install twine
twine upload dist/*

This will ask for your PyPI credentials. Once uploaded, you can install your package with:

pip install magento-dump

📜 License MIT License. Free to use and modify.

Metadata

Release files for magento-dump 1.0.33

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

Source distribution (sdist)

Source distribution for magento-dump 1.0.33
File Size Uploaded
magento_dump-1.0.33.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for magento-dump 1.0.33
File Interpreter ABI Platform
magento_dump-1.0.33-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / magento_dump-1.0.33.tar.gz

Download URL magento_dump-1.0.33.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ffde5edc6c4abbca16ab022dd2c535c431e895ee12a1625e8f4c9d54e253c180
BLAKE2b-256 checksum
How to use checksums
eb4fe21fff07b9c19605cde3d3638447137514ad4994566f77b372eb1d17ddf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / magento_dump-1.0.33-py3-none-any.whl

Download URL magento_dump-1.0.33-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72a8abf4f280cfd95905e7bc6df39e95e6b77b535d252398e1ece338c3c74a0c
BLAKE2b-256 checksum
How to use checksums
31aa5bc398650542450bfabea97e357fe3b44834233c12bf8882e241218e958a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.33 This release

2 release files

1.0.32

2 release files

1.0.31

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

1 release file

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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