Cli Documentation of the Flask app
DB Cli for Migrations
Perform database migrations.
flask db [OPTIONS] COMMAND [ARGS]...
Options
- -x, --x-arg <x_arg>
Additional arguments consumed by custom env.py scripts
branches
Show current branch points
flask db branches [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -v, --verbose
Use more verbose output
check
Check if there are any new operations to migrate
flask db check [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
current
Display the current revision for each database.
flask db current [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -v, --verbose
Use more verbose output
downgrade
Revert to a previous version
flask db downgrade [OPTIONS] [REVISION]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- --sql
Don’t emit SQL to database - dump to standard output instead
- --tag <tag>
Arbitrary “tag” name - can be used by custom env.py scripts
- -x, --x-arg <x_arg>
Additional arguments consumed by custom env.py scripts
Arguments
- REVISION
Optional argument
edit
Edit a revision file
flask db edit [OPTIONS] [REVISION]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
Arguments
- REVISION
Optional argument
heads
Show current available heads in the script directory
flask db heads [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -v, --verbose
Use more verbose output
- --resolve-dependencies
Treat dependency versions as down revisions
history
List changeset scripts in chronological order.
flask db history [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -r, --rev-range <rev_range>
Specify a revision range; format is [start]:[end]
- -v, --verbose
Use more verbose output
- -i, --indicate-current
Indicate current version (Alembic 0.9.9 or greater is required)
init
Creates a new migration repository.
flask db init [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- --multidb
Support multiple databases
- -t, --template <template>
Repository template to use (default is “flask”)
- --package
Write empty __init__.py files to the environment and version locations
list-templates
List available templates.
flask db list-templates [OPTIONS]
merge
Merge two revisions together, creating a new revision file
flask db merge [OPTIONS] [REVISIONS]...
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -m, --message <message>
Merge revision message
- --branch-label <branch_label>
Specify a branch label to apply to the new revision
- --rev-id <rev_id>
Specify a hardcoded revision id instead of generating one
Arguments
- REVISIONS
Optional argument(s)
migrate
Autogenerate a new revision file (Alias for ‘revision –autogenerate’)
flask db migrate [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -m, --message <message>
Revision message
- --sql
Don’t emit SQL to database - dump to standard output instead
- --head <head>
Specify head revision or <branchname>@head to base new revision on
- --splice
Allow a non-head revision as the “head” to splice onto
- --branch-label <branch_label>
Specify a branch label to apply to the new revision
- --version-path <version_path>
Specify specific path from config for version file
- --rev-id <rev_id>
Specify a hardcoded revision id instead of generating one
- -x, --x-arg <x_arg>
Additional arguments consumed by custom env.py scripts
revision
Create a new revision file.
flask db revision [OPTIONS]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- -m, --message <message>
Revision message
- --autogenerate
Populate revision script with candidate migration operations, based on comparison of database to model
- --sql
Don’t emit SQL to database - dump to standard output instead
- --head <head>
Specify head revision or <branchname>@head to base new revision on
- --splice
Allow a non-head revision as the “head” to splice onto
- --branch-label <branch_label>
Specify a branch label to apply to the new revision
- --version-path <version_path>
Specify specific path from config for version file
- --rev-id <rev_id>
Specify a hardcoded revision id instead of generating one
show
Show the revision denoted by the given symbol.
flask db show [OPTIONS] [REVISION]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
Arguments
- REVISION
Optional argument
stamp
‘stamp’ the revision table with the given revision; don’t run any migrations
flask db stamp [OPTIONS] [REVISION]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- --sql
Don’t emit SQL to database - dump to standard output instead
- --tag <tag>
Arbitrary “tag” name - can be used by custom env.py scripts
- --purge
Delete the version in the alembic_version table before stamping
Arguments
- REVISION
Optional argument
upgrade
Upgrade to a later version
flask db upgrade [OPTIONS] [REVISION]
Options
- -d, --directory <directory>
Migration script directory (default is “migrations”)
- --sql
Don’t emit SQL to database - dump to standard output instead
- --tag <tag>
Arbitrary “tag” name - can be used by custom env.py scripts
- -x, --x-arg <x_arg>
Additional arguments consumed by custom env.py scripts
Arguments
- REVISION
Optional argument
Flask-Smorest Cli for OpenAPI Spec
OpenAPI commands.
flask openapi [OPTIONS] COMMAND [ARGS]...
list-config-prefixes
List available API config prefixes.
flask openapi list-config-prefixes [OPTIONS]
print
Print OpenAPI JSON document.
flask openapi print [OPTIONS]
Options
- -f, --format <format>
- Options:
json | yaml
- --config-prefix <config_prefix>
write
Write OpenAPI JSON document to a file.
flask openapi write [OPTIONS] OUTPUT_FILE
Options
- -f, --format <format>
- Options:
json | yaml
- --config-prefix <config_prefix>
Arguments
- OUTPUT_FILE
Required argument
Babel Cli for Translations
See http://babel.pocoo.org/en/latest/cmdline.html#command-line-interface