Skip to main content

Mysqldump is a django package to import and export mysql database.

Project description

Mysqldump is a django package to import and export mysql database.

Installation

* pip install mysqldump
* Add 'dbmanager' to your 'settings.py'
* Run the below command to backup all database(s) configured inside *settings.py*
    ```
        $ ./manage.py exportdb
    ```

setting.py


Installed apps:

Add 'dbmanager' to your 'settings.py'

    INSTALLED_APPS = [
        'dbmanager',
    ]

TMP_DIR

Package will use system default tmp directory, if not specified.

    TMP_DIR = '/var/www/html/my_project/tmp/'

DUMP_DIR

By default dump file(s) will be stored in project container directory. Specify the location to store the dumped file(s).

    DUMP_DIR = '/var/www/html/my_project/backup_dir/'

Commands


Export Database

exportdb will dump all database(s) specified inside settings.py.

    $ ./manage.py exportdb

Running exportdb:
Selected Database: db_name1
Processing file: 20201130095543386091_db_name1.dump
Dump completed on 2020-Nov-30 09:55:43

  • To dump specified database using database name.

    -d, --databases

    $ ./manage.py exportdb --databases db_name1 db_name2 ....

Running exportdb:
Selected Database: db_name1
Processing file: 20201130095543386091_db_name1.dump
Dump completed on 2020-Nov-30 09:55:43
Running exportdb:
Selected Database: db_name1
Processing file: 20201130095543920698_db_name2.dump
Dump completed on 2020-Nov-30 09:55:43

  • To archive the dump data with gzip.

    -gz, --compress

    $ ./manage.py exportdb --compress

Running exportdb:
Selected Database: db_name1
Processing file: 20201130095543386091_db_name1.dump.gz
Dump completed on 2020-Nov-30 09:55:43

  • To dump specified table from database.

    -tbl, --tables

    $ ./manage.py exportdb -d db_name1 --tables tbl_name1 tbl_name2
  • To ignore specified table from database(s).

    itbl, --ignore-table

    $ ./manage.py exportdb -d db_name1 --ignore-table db_name1.tbl_name1
    $ ./manage.py exportdb -d db_name1 db_name2 --ignore-table db_name1.tbl_name1 db_name2.tbl_name2

Import Database

importdb to restore the specified database.

  • By default package will check project container directory or DUMP_DIR for the file.

    -f, --filename

    $ ./manage.py importdb dbname1 -f db_name1.dump.gz

Running importdb:
Selected Database: db_name1
Processing file: db_name1.dump.gz
Restore completed on 2020-Nov-30 09:55:43

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

mysqldump-0.0.10.tar.gz (11.4 kB view details)

Uploaded Source

File details

Details for the file mysqldump-0.0.10.tar.gz.

File metadata

  • Download URL: mysqldump-0.0.10.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for mysqldump-0.0.10.tar.gz
Algorithm Hash digest
SHA256 a945034600089e28a4725bc87176c732c240d0cbf8902ab535d750f108f04498
MD5 614ed74e48589b731fa83e734cb20cf2
BLAKE2b-256 e834368bee5ac8ccf8c88d2a1a4383d49c7067d41247bd2d34a3714d97900988

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page