Skip to main content

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.

Metadata

Release files for pymongo-migrate 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymongo-migrate 1.0.0
File Size Uploaded
pymongo-migrate-1.0.0.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymongo-migrate 1.0.0
File Interpreter ABI Platform
pymongo_migrate-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.9 kB

Release files / pymongo-migrate-1.0.0.tar.gz

Download URL pymongo-migrate-1.0.0.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7021abd27c42dbc991adc667694c9dc89f22c9d9c4d191d0dd684f05d56798f6
BLAKE2b-256 checksum
How to use checksums
b0c657e64aa7f13e046e9b38897ae743930d455ad40625df25bcd0f3c8d4b5f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / pymongo_migrate-1.0.0-py3-none-any.whl

Download URL pymongo_migrate-1.0.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b5303233ce7fab35618239f4737287185ec2abf10b5cdacf3c80ec88a09eac2
BLAKE2b-256 checksum
How to use checksums
03d7e3fe8d07b85f31e8304c8723f03003dfcac5c68b6505cdb379418a08f5b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.11.0

1 release file

0.10.0

1 release file

0.9.1

1 release file

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page