Skip to content

Autogenerate migration has minor typing issues with mypy #1253

@igorbga

Description

@igorbga

Using SqlAlchemy 2.X and Alembic 1.11.1.

mypy is complaining about down_revision, branch_labels, and depends_on needing explicit type annotation.

I guess that for down_revision this is only an issue for the first migration because after that it will always be initialized and detected as str.

The fix seems trivial, but I'm not an Alembic expert at all so I might be missing something:

down_revision: Optional[str] = None
branch_labels: Optional[str] = None
depends_on: Optional[str] = None

Maybe this is intended and neccesary in order to keep backwards compatibility with Python 2.x ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpep 484typing related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions