MongoDB data migration tool in Python
Project description
pymongo-migrate
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7021abd27c42dbc991adc667694c9dc89f22c9d9c4d191d0dd684f05d56798f6 |
|
MD5 | 8f1d096f62713fb476d642cb1c60ed14 |
|
BLAKE2b-256 | b0c657e64aa7f13e046e9b38897ae743930d455ad40625df25bcd0f3c8d4b5f0 |
File details
Details for the file pymongo_migrate-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pymongo_migrate-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b5303233ce7fab35618239f4737287185ec2abf10b5cdacf3c80ec88a09eac2 |
|
MD5 | e8a1ec0671ada8080f7a0c3606dd5b22 |
|
BLAKE2b-256 | 03d7e3fe8d07b85f31e8304c8723f03003dfcac5c68b6505cdb379418a08f5b1 |