Skip to main content

Magento Database Dump & Table Analyzer Tool

Project description

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/*

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.

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

magento_dump-1.0.13.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

magento_dump-1.0.13-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file magento_dump-1.0.13.tar.gz.

File metadata

  • Download URL: magento_dump-1.0.13.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for magento_dump-1.0.13.tar.gz
Algorithm Hash digest
SHA256 7c8798574054a82559dd52defc5350d8fe4bb155c4229253cb36ebcaa02b031c
MD5 386ea6c5e5c9fcb0542598772a53b356
BLAKE2b-256 eab73e6320cbf7e9c2fe7835a75a885c7f72a8191d00e9e9d730bf94a81f88a3

See more details on using hashes here.

File details

Details for the file magento_dump-1.0.13-py3-none-any.whl.

File metadata

  • Download URL: magento_dump-1.0.13-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for magento_dump-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 0d075b394f746c292fb3de9d406cf6fa186840d3e60c543def344e25647cc1e8
MD5 45ebc1a9fd21b9f1d73d7a2cf454ac6d
BLAKE2b-256 02ec3f473668ad957b945c80a04041e85af6067f6bb7d3e9fabfe30c09d9d8cb

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