Skip to main content

Flask extension for working with Alembic

Project description

Flask-DbMigrant

Flask extension for working with Alembic.

It can be used as an alternative for Flask-Migrate. It depends only on Flask and Alembic.

Installation

$ pip install Flask-DbMigrant

Usage

First create the dbmigrant object:

from flask_dbmigrant import DbMigrant
dbmigrant = DbMigrant()

Then initialize it using init_app method:

dbmigrant.init_app(app)  # app is your Flask app instance

The Flask app config should have CONFIG_MODULE and DB_MODULE keys.

CONFIG_MODULE is a name of the module from which DATABASE_URL is to be imported (DATABASE_URL is a connection string that tells what database to connect to).

DB_MODULE is a name of the module from which database models and metadata are to be imported.

Existing commands

  • flask db init

    create a migration repository and configure the environment

  • flask db migrate

    create a migration script

  • flask db upgrade

    execute the script

License

Flask-DbMigrant was created by Rafal Padkowski. It is licensed under the terms of the MIT license.

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

flask_dbmigrant-1.0.3.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

flask_dbmigrant-1.0.3-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

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