mysql-to-sqlite3


Namemysql-to-sqlite3 JSON
Version 2.3.0 PyPI version JSON
download
home_pageNone
SummaryA simple Python tool to transfer data from MySQL to SQLite 3
upload_time2024-07-30 20:32:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords data migrate migration mysql sqlite3 transfer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/mysql-to-sqlite3)](https://pypi.org/project/mysql-to-sqlite3/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/mysql-to-sqlite3)](https://pypistats.org/packages/mysql-to-sqlite3)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mysql-to-sqlite3)](https://pypi.org/project/mysql-to-sqlite3/)
[![MySQL Support](https://img.shields.io/static/v1?label=MySQL&message=5.5+|+5.6+|+5.7+|+8.0+|+8.4&color=2b5d80)](https://img.shields.io/static/v1?label=MySQL&message=5.5+|+5.6+|+5.7+|+8.0+|+8.4&color=2b5d80)
[![MariaDB Support](https://img.shields.io/static/v1?label=MariaDB&message=5.5+|+10.0+|+10.1+|+10.2+|+10.3+|+10.4+|+10.5+|+10.6|+10.11+|+11.4&color=C0765A)](https://img.shields.io/static/v1?label=MariaDB&message=5.5|+10.0+|+10.1+|+10.2+|+10.3+|+10.4+|+10.5|+11.4&color=C0765A)
[![GitHub license](https://img.shields.io/github/license/techouse/mysql-to-sqlite3)](https://github.com/techouse/mysql-to-sqlite3/blob/master/LICENSE)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE-OF-CONDUCT.md)
[![PyPI - Format](https://img.shields.io/pypi/format/mysql-to-sqlite3)](https://pypi.org/project/sqlite3-to-mysql/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/64aae8e9599746d58d277852b35cc2bd)](https://www.codacy.com/manual/techouse/mysql-to-sqlite3?utm_source=github.com&utm_medium=referral&utm_content=techouse/mysql-to-sqlite3&utm_campaign=Badge_Grade)
[![Test Status](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/test.yml/badge.svg)](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/test.yml)
[![CodeQL Status](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/codeql-analysis.yml)
[![Publish PyPI Package Status](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/publish.yml/badge.svg)](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/publish.yml)
[![codecov](https://codecov.io/gh/techouse/mysql-to-sqlite3/branch/master/graph/badge.svg)](https://codecov.io/gh/techouse/mysql-to-sqlite3)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/techouse)](https://github.com/sponsors/techouse)
[![GitHub stars](https://img.shields.io/github/stars/techouse/mysql-to-sqlite3.svg?style=social&label=Star&maxAge=2592000)](https://github.com/techouse/mysql-to-sqlite3/stargazers)

# MySQL to SQLite3

#### A simple Python tool to transfer data from MySQL to SQLite 3.

### How to run

```bash
pip install mysql-to-sqlite3
mysql2sqlite --help
```

### Usage

```
Usage: mysql2sqlite [OPTIONS]

Options:
  -f, --sqlite-file PATH          SQLite3 database file  [required]
  -d, --mysql-database TEXT       MySQL database name  [required]
  -u, --mysql-user TEXT           MySQL user  [required]
  -p, --prompt-mysql-password     Prompt for MySQL password
  --mysql-password TEXT           MySQL password
  -t, --mysql-tables TUPLE        Transfer only these specific tables (space
                                  separated table names). Implies --without-
                                  foreign-keys which inhibits the transfer of
                                  foreign keys. Can not be used together with
                                  --exclude-mysql-tables.
  -e, --exclude-mysql-tables TUPLE
                                  Transfer all tables except these specific
                                  tables (space separated table names).
                                  Implies --without-foreign-keys which
                                  inhibits the transfer of foreign keys. Can
                                  not be used together with --mysql-tables.
  -L, --limit-rows INTEGER        Transfer only a limited number of rows from
                                  each table.
  -C, --collation [BINARY|NOCASE|RTRIM]
                                  Create datatypes of TEXT affinity using a
                                  specified collation sequence.  [default:
                                  BINARY]
  -K, --prefix-indices            Prefix indices with their corresponding
                                  tables. This ensures that their names remain
                                  unique across the SQLite database.
  -X, --without-foreign-keys      Do not transfer foreign keys.
  -Z, --without-tables            Do not transfer tables, data only.
  -W, --without-data              Do not transfer table data, DDL only.
  -h, --mysql-host TEXT           MySQL host. Defaults to localhost.
  -P, --mysql-port INTEGER        MySQL port. Defaults to 3306.
  --mysql-charset TEXT            MySQL database and table character set
                                  [default: utf8mb4]
  --mysql-collation TEXT          MySQL database and table collation
  -S, --skip-ssl                  Disable MySQL connection encryption.
  -c, --chunk INTEGER             Chunk reading/writing SQL records
  -l, --log-file PATH             Log file
  --json-as-text                  Transfer JSON columns as TEXT.
  -V, --vacuum                    Use the VACUUM command to rebuild the SQLite
                                  database file, repacking it into a minimal
                                  amount of disk space
  --use-buffered-cursors          Use MySQLCursorBuffered for reading the
                                  MySQL database. This can be useful in
                                  situations where multiple queries, with
                                  small result sets, need to be combined or
                                  computed with each other.
  -q, --quiet                     Quiet. Display only errors.
  --debug                         Debug mode. Will throw exceptions.
  --version                       Show the version and exit.
  --help                          Show this message and exit.
```

#### Docker

If you don't want to install the tool on your system, you can use the Docker image instead.

```bash
docker run -it \
    --workdir $(pwd) \
    --volume $(pwd):$(pwd) \
    --rm ghcr.io/techouse/mysql-to-sqlite3:latest \
    --sqlite-file baz.db \
    --mysql-user foo \
    --mysql-password bar \
    --mysql-database baz \
    --mysql-host host.docker.internal
```

This will mount your host current working directory (pwd) inside the Docker container as the current working directory.
Any files Docker would write to the current working directory are written to the host directory where you did docker
run. Note that you have to also use a
[special hostname](https://docs.docker.com/desktop/networking/#use-cases-and-workarounds-for-all-platforms) `host.docker.internal`
to access your host machine from inside the Docker container.

#### Homebrew

If you're on macOS, you can install the tool using [Homebrew](https://brew.sh/).

```bash
brew tap techouse/mysql-to-sqlite3
brew install mysql-to-sqlite3
mysql2sqlite --help
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mysql-to-sqlite3",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "data, migrate, migration, mysql, sqlite3, transfer",
    "author": null,
    "author_email": "Klemen Tusar <techouse@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/0c/16/a33beb3ae1007d2154f0e0c1a0da789d883c22797a9fd033e3331f8d829d/mysql_to_sqlite3-2.3.0.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/mysql-to-sqlite3)](https://pypi.org/project/mysql-to-sqlite3/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/mysql-to-sqlite3)](https://pypistats.org/packages/mysql-to-sqlite3)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mysql-to-sqlite3)](https://pypi.org/project/mysql-to-sqlite3/)\n[![MySQL Support](https://img.shields.io/static/v1?label=MySQL&message=5.5+|+5.6+|+5.7+|+8.0+|+8.4&color=2b5d80)](https://img.shields.io/static/v1?label=MySQL&message=5.5+|+5.6+|+5.7+|+8.0+|+8.4&color=2b5d80)\n[![MariaDB Support](https://img.shields.io/static/v1?label=MariaDB&message=5.5+|+10.0+|+10.1+|+10.2+|+10.3+|+10.4+|+10.5+|+10.6|+10.11+|+11.4&color=C0765A)](https://img.shields.io/static/v1?label=MariaDB&message=5.5|+10.0+|+10.1+|+10.2+|+10.3+|+10.4+|+10.5|+11.4&color=C0765A)\n[![GitHub license](https://img.shields.io/github/license/techouse/mysql-to-sqlite3)](https://github.com/techouse/mysql-to-sqlite3/blob/master/LICENSE)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE-OF-CONDUCT.md)\n[![PyPI - Format](https://img.shields.io/pypi/format/mysql-to-sqlite3)](https://pypi.org/project/sqlite3-to-mysql/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/64aae8e9599746d58d277852b35cc2bd)](https://www.codacy.com/manual/techouse/mysql-to-sqlite3?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=techouse/mysql-to-sqlite3&amp;utm_campaign=Badge_Grade)\n[![Test Status](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/test.yml/badge.svg)](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/test.yml)\n[![CodeQL Status](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/codeql-analysis.yml)\n[![Publish PyPI Package Status](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/publish.yml/badge.svg)](https://github.com/techouse/mysql-to-sqlite3/actions/workflows/publish.yml)\n[![codecov](https://codecov.io/gh/techouse/mysql-to-sqlite3/branch/master/graph/badge.svg)](https://codecov.io/gh/techouse/mysql-to-sqlite3)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/techouse)](https://github.com/sponsors/techouse)\n[![GitHub stars](https://img.shields.io/github/stars/techouse/mysql-to-sqlite3.svg?style=social&label=Star&maxAge=2592000)](https://github.com/techouse/mysql-to-sqlite3/stargazers)\n\n# MySQL to SQLite3\n\n#### A simple Python tool to transfer data from MySQL to SQLite 3.\n\n### How to run\n\n```bash\npip install mysql-to-sqlite3\nmysql2sqlite --help\n```\n\n### Usage\n\n```\nUsage: mysql2sqlite [OPTIONS]\n\nOptions:\n  -f, --sqlite-file PATH          SQLite3 database file  [required]\n  -d, --mysql-database TEXT       MySQL database name  [required]\n  -u, --mysql-user TEXT           MySQL user  [required]\n  -p, --prompt-mysql-password     Prompt for MySQL password\n  --mysql-password TEXT           MySQL password\n  -t, --mysql-tables TUPLE        Transfer only these specific tables (space\n                                  separated table names). Implies --without-\n                                  foreign-keys which inhibits the transfer of\n                                  foreign keys. Can not be used together with\n                                  --exclude-mysql-tables.\n  -e, --exclude-mysql-tables TUPLE\n                                  Transfer all tables except these specific\n                                  tables (space separated table names).\n                                  Implies --without-foreign-keys which\n                                  inhibits the transfer of foreign keys. Can\n                                  not be used together with --mysql-tables.\n  -L, --limit-rows INTEGER        Transfer only a limited number of rows from\n                                  each table.\n  -C, --collation [BINARY|NOCASE|RTRIM]\n                                  Create datatypes of TEXT affinity using a\n                                  specified collation sequence.  [default:\n                                  BINARY]\n  -K, --prefix-indices            Prefix indices with their corresponding\n                                  tables. This ensures that their names remain\n                                  unique across the SQLite database.\n  -X, --without-foreign-keys      Do not transfer foreign keys.\n  -Z, --without-tables            Do not transfer tables, data only.\n  -W, --without-data              Do not transfer table data, DDL only.\n  -h, --mysql-host TEXT           MySQL host. Defaults to localhost.\n  -P, --mysql-port INTEGER        MySQL port. Defaults to 3306.\n  --mysql-charset TEXT            MySQL database and table character set\n                                  [default: utf8mb4]\n  --mysql-collation TEXT          MySQL database and table collation\n  -S, --skip-ssl                  Disable MySQL connection encryption.\n  -c, --chunk INTEGER             Chunk reading/writing SQL records\n  -l, --log-file PATH             Log file\n  --json-as-text                  Transfer JSON columns as TEXT.\n  -V, --vacuum                    Use the VACUUM command to rebuild the SQLite\n                                  database file, repacking it into a minimal\n                                  amount of disk space\n  --use-buffered-cursors          Use MySQLCursorBuffered for reading the\n                                  MySQL database. This can be useful in\n                                  situations where multiple queries, with\n                                  small result sets, need to be combined or\n                                  computed with each other.\n  -q, --quiet                     Quiet. Display only errors.\n  --debug                         Debug mode. Will throw exceptions.\n  --version                       Show the version and exit.\n  --help                          Show this message and exit.\n```\n\n#### Docker\n\nIf you don't want to install the tool on your system, you can use the Docker image instead.\n\n```bash\ndocker run -it \\\n    --workdir $(pwd) \\\n    --volume $(pwd):$(pwd) \\\n    --rm ghcr.io/techouse/mysql-to-sqlite3:latest \\\n    --sqlite-file baz.db \\\n    --mysql-user foo \\\n    --mysql-password bar \\\n    --mysql-database baz \\\n    --mysql-host host.docker.internal\n```\n\nThis will mount your host current working directory (pwd) inside the Docker container as the current working directory.\nAny files Docker would write to the current working directory are written to the host directory where you did docker\nrun. Note that you have to also use a\n[special hostname](https://docs.docker.com/desktop/networking/#use-cases-and-workarounds-for-all-platforms) `host.docker.internal`\nto access your host machine from inside the Docker container.\n\n#### Homebrew\n\nIf you're on macOS, you can install the tool using [Homebrew](https://brew.sh/).\n\n```bash\nbrew tap techouse/mysql-to-sqlite3\nbrew install mysql-to-sqlite3\nmysql2sqlite --help\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple Python tool to transfer data from MySQL to SQLite 3",
    "version": "2.3.0",
    "project_urls": {
        "Changelog": "https://github.com/techouse/mysql-to-sqlite3/blob/master/CHANGELOG.md",
        "Documentation": "https://techouse.github.io/mysql-to-sqlite3/",
        "Homepage": "https://techouse.github.io/mysql-to-sqlite3/",
        "PayPal": "https://paypal.me/ktusar",
        "Source": "https://github.com/techouse/mysql-to-sqlite3",
        "Sponsor": "https://github.com/sponsors/techouse"
    },
    "split_keywords": [
        "data",
        " migrate",
        " migration",
        " mysql",
        " sqlite3",
        " transfer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c37fd39e644e84aa881005817494f210636793d7e9fd0cb025856e0fd06eaa4b",
                "md5": "e64ba2e8ae7380ec9bb006b5ce47c81e",
                "sha256": "b7653622a69ed300e3e91eec5e6004605bb9c21c6ddc767a207beafb56d78f52"
            },
            "downloads": -1,
            "filename": "mysql_to_sqlite3-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e64ba2e8ae7380ec9bb006b5ce47c81e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 19692,
            "upload_time": "2024-07-30T20:32:32",
            "upload_time_iso_8601": "2024-07-30T20:32:32.889641Z",
            "url": "https://files.pythonhosted.org/packages/c3/7f/d39e644e84aa881005817494f210636793d7e9fd0cb025856e0fd06eaa4b/mysql_to_sqlite3-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c16a33beb3ae1007d2154f0e0c1a0da789d883c22797a9fd033e3331f8d829d",
                "md5": "4a975268f64f0084be142ada80fd9fa5",
                "sha256": "e5314a7394ea980408efd2272f69a42917979501b99b28d9a56707293aa62313"
            },
            "downloads": -1,
            "filename": "mysql_to_sqlite3-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4a975268f64f0084be142ada80fd9fa5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 37710,
            "upload_time": "2024-07-30T20:32:35",
            "upload_time_iso_8601": "2024-07-30T20:32:35.499150Z",
            "url": "https://files.pythonhosted.org/packages/0c/16/a33beb3ae1007d2154f0e0c1a0da789d883c22797a9fd033e3331f8d829d/mysql_to_sqlite3-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-30 20:32:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "techouse",
    "github_project": "mysql-to-sqlite3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "mysql-to-sqlite3"
}
        
Elapsed time: 2.01480s