mongo-migrate


Namemongo-migrate JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryMigrate mongodb seamlessly with python and mongo-migrate. Supports migration creation, upgrade, and downgrade
upload_time2023-08-22 14:17:16
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2023 blitzcode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords mongodb migration mongodb migration database automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Welcome to mongo-migrate

Migrate Mongodb seamlessly using Python and mongo-migrate. 

MongoDB is a schemaless database but most of the time the data that you store in the database will end up have a loose schema. 
The Python library is aimed to solve the below problem scenarios: 
  1. As your project grows, the schema also changes and grows with it. When you want to go back to a specific version of the code and run that version. Most of the time, you do not remember the database schema used with the particular version of code. This is where creating a migration file and keeping it under version control along with your code helps. You can retrace the steps to that particular version of the schema. 
  2. Lastly, even if your code base is in another language, you can use the Mongo-migrate package to create migrations. Exactly for this reason, mongo-migrate is coming out of the box with a lot of subcommands. 

You can read my the detailed article [here](https://rahulgeorge.hashnode.dev/migrate-mongodb-data-seamlessly-with-mongo-migrate-and-python)

The mongo-migrate library can create migrations, and perform upgrade and downgrade operations.

### Installation

    pip install mongo-migrate

### Usage

    usage: mongo-migrate [-h] {create,upgrade,downgrade} ...
    
    positional arguments:
      {create, upgrade, downgrade}
        create              create a new migration
        upgrade             upgrade the database to the specific migration
        downgrade           downgrade the database to the specific migration
    
    optional arguments:
      -h, --help            show this help message and exit

## Key Features

### Create Migrations

    usage: mongo-migrate create [-h] [--host HOST] [--port PORT] [--database DATABASE] [--migrations MIGRATIONS] [--title TITLE] --message MESSAGE
    
    optional arguments:
      -h, --help            show this help message and exit
      --host HOST           the database host
      --port PORT           the database port
      --database DATABASE   provide the database name
      --migrations MIGRATIONS
                            provide the folder to store migrations
      --title TITLE         title will be used in the file name
      --message MESSAGE     message will be recorded as a comment inside the migration file

An example command would look like this:
    
    mongo-migrate create --host 127.0.0.1 --port 27017 --database test --message 'first migration'


### Upgrade database

    usage: mongo-migrate upgrade [-h] [--host HOST] [--port PORT] [--database DATABASE] [--migrations MIGRATIONS] [--upto UPTO]

    optional arguments:
      -h, --help            show this help message and exit
      --host HOST           the database host
      --port PORT           the database port
      --database DATABASE   provide the database name
      --migrations MIGRATIONS
                            provide the folder to store migrations
      --upto UPTO           target migration timestamp

An example command would look like this:
    
    mongo-migrate upgrade --host 127.0.0.1 --port 27017 --database test --upto 20230815092813

### Downgrade database

    usage: mongo-migrate downgrade [-h] [--host HOST] [--port PORT] [--database DATABASE] [--migrations MIGRATIONS] [--upto UPTO]

    optional arguments:
      -h, --help            show this help message and exit
      --host HOST           the database host
      --port PORT           the database port
      --database DATABASE   provide the database name
      --migrations MIGRATIONS
                            provide the folder to store migrations
      --upto UPTO           target migration timestamp

An example command would look like this:
    
    mongo-migrate downgrade --host 127.0.0.1 --port 27017 --database test --upto 20230815092813

## Planned Enhancements

Our commitment to continuous improvement includes planned features such as:
  * Support for connection string, 
  * Support for authenticated databases
  * Configuration Files: Eliminate the need for repetitive CLI arguments. 
  * More migration generation shortcuts

## Get Involved
If you encounter any issues, please raise it as a ticket in the [issue tracker.](https://github.com/blitzcode-io/mongo-migrate/issues)
If you like to contribute to this open-source project, [let me know](https://www.linkedin.com/in/rahultgeorge05). 


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mongo-migrate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "mongodb,migration,mongodb migration,database,automation",
    "author": "",
    "author_email": "Rahul George <34202955+rahul-george@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/42/f2/0ca0978f7faca688943e1a17d12b49fb316279d6239bf69cb4ff26d6e02d/mongo_migrate-0.1.1.tar.gz",
    "platform": null,
    "description": "# Welcome to mongo-migrate\n\nMigrate Mongodb seamlessly using Python and mongo-migrate. \n\nMongoDB is a schemaless database but most of the time the data that you store in the database will end up have a loose schema. \nThe Python library is aimed to solve the below problem scenarios: \n  1. As your project grows, the schema also changes and grows with it. When you want to go back to a specific version of the code and run that version. Most of the time, you do not remember the database schema used with the particular version of code. This is where creating a migration file and keeping it under version control along with your code helps. You can retrace the steps to that particular version of the schema. \n  2. Lastly, even if your code base is in another language, you can use the Mongo-migrate package to create migrations. Exactly for this reason, mongo-migrate is coming out of the box with a lot of subcommands. \n\nYou can read my the detailed article [here](https://rahulgeorge.hashnode.dev/migrate-mongodb-data-seamlessly-with-mongo-migrate-and-python)\n\nThe mongo-migrate library can create migrations, and perform upgrade and downgrade operations.\n\n### Installation\n\n    pip install mongo-migrate\n\n### Usage\n\n    usage: mongo-migrate [-h] {create,upgrade,downgrade} ...\n    \n    positional arguments:\n      {create, upgrade, downgrade}\n        create              create a new migration\n        upgrade             upgrade the database to the specific migration\n        downgrade           downgrade the database to the specific migration\n    \n    optional arguments:\n      -h, --help            show this help message and exit\n\n## Key Features\n\n### Create Migrations\n\n    usage: mongo-migrate create [-h] [--host HOST] [--port PORT] [--database DATABASE] [--migrations MIGRATIONS] [--title TITLE] --message MESSAGE\n    \n    optional arguments:\n      -h, --help            show this help message and exit\n      --host HOST           the database host\n      --port PORT           the database port\n      --database DATABASE   provide the database name\n      --migrations MIGRATIONS\n                            provide the folder to store migrations\n      --title TITLE         title will be used in the file name\n      --message MESSAGE     message will be recorded as a comment inside the migration file\n\nAn example command would look like this:\n    \n    mongo-migrate create --host 127.0.0.1 --port 27017 --database test --message 'first migration'\n\n\n### Upgrade database\n\n    usage: mongo-migrate upgrade [-h] [--host HOST] [--port PORT] [--database DATABASE] [--migrations MIGRATIONS] [--upto UPTO]\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --host HOST           the database host\n      --port PORT           the database port\n      --database DATABASE   provide the database name\n      --migrations MIGRATIONS\n                            provide the folder to store migrations\n      --upto UPTO           target migration timestamp\n\nAn example command would look like this:\n    \n    mongo-migrate upgrade --host 127.0.0.1 --port 27017 --database test --upto 20230815092813\n\n### Downgrade database\n\n    usage: mongo-migrate downgrade [-h] [--host HOST] [--port PORT] [--database DATABASE] [--migrations MIGRATIONS] [--upto UPTO]\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --host HOST           the database host\n      --port PORT           the database port\n      --database DATABASE   provide the database name\n      --migrations MIGRATIONS\n                            provide the folder to store migrations\n      --upto UPTO           target migration timestamp\n\nAn example command would look like this:\n    \n    mongo-migrate downgrade --host 127.0.0.1 --port 27017 --database test --upto 20230815092813\n\n## Planned Enhancements\n\nOur commitment to continuous improvement includes planned features such as:\n  * Support for connection string, \n  * Support for authenticated databases\n  * Configuration Files: Eliminate the need for repetitive CLI arguments. \n  * More migration generation shortcuts\n\n## Get Involved\nIf you encounter any issues, please raise it as a ticket in the [issue tracker.](https://github.com/blitzcode-io/mongo-migrate/issues)\nIf you like to contribute to this open-source project, [let me know](https://www.linkedin.com/in/rahultgeorge05). \n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 blitzcode  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Migrate mongodb seamlessly with python and mongo-migrate. Supports migration creation, upgrade, and downgrade",
    "version": "0.1.1",
    "project_urls": {
        "Blog": "https://rahulgeorge.hashnode.dev/migrate-mongodb-data-seamlessly-with-mongo-migrate-and-python",
        "Bug Tracker": "https://github.com/blitzcode-io/mongo-migrate/issues",
        "Repository": "https://github.com/blitzcode-io/mongo-migrate"
    },
    "split_keywords": [
        "mongodb",
        "migration",
        "mongodb migration",
        "database",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "288dcf283ac4b358430d7cd48e83fe21d0ebb42b91651796a404461b790e4f32",
                "md5": "e02deefc4f7ec0a19f68a7cc10e979f1",
                "sha256": "669e8ef4a5d832f165e189b5c46a50a79aea491ddba4946a51ff2d2b75db03ad"
            },
            "downloads": -1,
            "filename": "mongo_migrate-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e02deefc4f7ec0a19f68a7cc10e979f1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8721,
            "upload_time": "2023-08-22T14:17:14",
            "upload_time_iso_8601": "2023-08-22T14:17:14.850515Z",
            "url": "https://files.pythonhosted.org/packages/28/8d/cf283ac4b358430d7cd48e83fe21d0ebb42b91651796a404461b790e4f32/mongo_migrate-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42f20ca0978f7faca688943e1a17d12b49fb316279d6239bf69cb4ff26d6e02d",
                "md5": "d87ec0ffde3084cd88d85b09ceed1198",
                "sha256": "15b1ca14abf112f7a32ab15f771d9c35479df450cd6f65d95800b7f72d9dc911"
            },
            "downloads": -1,
            "filename": "mongo_migrate-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d87ec0ffde3084cd88d85b09ceed1198",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8618,
            "upload_time": "2023-08-22T14:17:16",
            "upload_time_iso_8601": "2023-08-22T14:17:16.315982Z",
            "url": "https://files.pythonhosted.org/packages/42/f2/0ca0978f7faca688943e1a17d12b49fb316279d6239bf69cb4ff26d6e02d/mongo_migrate-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-22 14:17:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blitzcode-io",
    "github_project": "mongo-migrate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mongo-migrate"
}
        
Elapsed time: 0.10137s