log = logging.getLogger(__name__)
+
def list_templates(config):
"""List available templates.
def check(
config: "Config",
) -> None:
- """Checks if the revision command with autogenerate has pending upgrade ops to run.
+ """Checks if the revision command with autogenerate has pending upgrade
+ ops to run.
:param config: a :class:`.Config` object.
migration_script = revision_context.generated_revisions[-1]
diffs = migration_script.upgrade_ops.as_diffs()
if diffs:
- raise util.RevisionOpsNotEmptyError(f"Revision has upgrade ops to run: {diffs}.")
+ raise util.RevisionOpsNotEmptyError(
+ f"Revision has upgrade ops to run: {diffs}."
+ )
else:
- log.info("Revision has no upgrade ops to run.")
+ log.info("Revision has no upgrade ops to run.")
def merge(
from typing import cast
from sqlalchemy import exc as sqla_exc
-from sqlalchemy import VARCHAR, text
+from sqlalchemy import text, VARCHAR
from sqlalchemy.engine import Engine
from sqlalchemy.sql.schema import Column
def test_check_no_changes(self):
self._env_fixture()
- command.check(self.cfg) # no problem
+ command.check(self.cfg) # no problem
def test_check_changes_detected(self):
self._env_fixture()
with mock.patch(
"alembic.operations.ops.UpgradeOps.as_diffs",
- return_value=[('remove_column', None, 'foo', Column('old_data', VARCHAR()))]
+ return_value=[('remove_column', None, 'foo',
+ Column('old_data', VARCHAR()))]
):
assert_raises_message(
util.RevisionOpsNotEmptyError,