Skip to content

Commit 1a7257d

Browse files
author
Thomas Preud'homme
committed
Fix type hint for add_column in lnt.server.db.util
statement variable in lnt.server.db.util's add_column method is of type DDLElement. As per [1], the bind argument of its execute() method is optional and take "an Engine or Connection". This commit updates add_column's type hint accordingly. [1] https://docs.sqlalchemy.org/en/13/core/ddl.html#sqlalchemy.schema.DDLElement.execute Reviewed By: danilaml Differential Revision: https://reviews.llvm.org/D95064
1 parent 001ac8f commit 1a7257d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lnt/server/db/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import sqlalchemy
22
import sqlalchemy.ext.compiler
3-
from sqlalchemy.engine.interfaces import Connectable
3+
from sqlalchemy.engine import Connection, Engine
44
from sqlalchemy.schema import DDLElement
55
from sqlalchemy.ext.compiler import compiles
6-
from typing import Text
6+
from typing import Text, Union
77

88

99
def path_has_no_database_type(path):
@@ -24,7 +24,7 @@ def _visit_add_column(element, compiler, **_):
2424

2525

2626
def add_column(connectable, table_name, column):
27-
# type: (Connectable, Text, sqlalchemy.Column) -> None
27+
# type: (Union[Engine, Connection, None], Text, sqlalchemy.Column) -> None
2828
"""Add this column to the table named `table_name`.
2929
3030
This is a stopgap to a real migration system. Inspect the Column pass

0 commit comments

Comments
 (0)