Skip to main content

MongoDB data migration tool in Python

Project description

pymongo-migrate

Build Status PyPI version

PyPI - Python Version

Mongodb migrations using Python.

Since mongodb is schema-less most of the time you can do without data migrations. Sometimes tho you want to create some new entities, or migrate old data instead adding another IF statement to your code. This is where pymongo-migrate comes in.

Usage

Usage: pymongo-migrate [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  downgrade  apply necessary downgrades to reach target migration
  graph
  migrate    automagically apply necessary upgrades or downgrades to reach
             target migration
  show       show migrations and their status
  upgrade    apply necessary upgrades to reach target migration

The most used command will be migrate, which works can be called like this:

$ pymongo-migrate migrate -u 'mongodb://localhost/test_db' -m tests/migrations

Use pymongo-migrate command --help to learn more about particular command.

Development & contributing to the project

Contributions and raising Issues is welcome; standard netiquette rules apply.

Use make init to setup the project for development. To format your code & test your changes run:

make check

Alternatives

ATM there seem only two active python projects like this:

So if something already existed, why then another project?

Goals of this project, where at least one of them were not fulfilled by above:

  • tests and CI pipeline for ensuring that tool indeed works
  • keeping it usable both as standalone tool and as python dependency
  • use of modern Python version, which allows use of type annotations, dataclasses, f-strings and other goodies

Inspiration and design

Other than Alternatives mentioned above, both alembic and django were used as references when designing this tool.

For now only linear revision history is supported. The support for squash migrations is planned.

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

pymongo-migrate-1.0.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

pymongo_migrate-1.0.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file pymongo-migrate-1.0.0.tar.gz.

File metadata

  • Download URL: pymongo-migrate-1.0.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pymongo-migrate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7021abd27c42dbc991adc667694c9dc89f22c9d9c4d191d0dd684f05d56798f6
MD5 8f1d096f62713fb476d642cb1c60ed14
BLAKE2b-256 b0c657e64aa7f13e046e9b38897ae743930d455ad40625df25bcd0f3c8d4b5f0

See more details on using hashes here.

File details

Details for the file pymongo_migrate-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymongo_migrate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b5303233ce7fab35618239f4737287185ec2abf10b5cdacf3c80ec88a09eac2
MD5 e8a1ec0671ada8080f7a0c3606dd5b22
BLAKE2b-256 03d7e3fe8d07b85f31e8304c8723f03003dfcac5c68b6505cdb379418a08f5b1

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