Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use Column with automatic data type and ForeignKey #204

Open
jace opened this issue Jan 17, 2021 · 0 comments
Open

Can't use Column with automatic data type and ForeignKey #204

jace opened this issue Jan 17, 2021 · 0 comments

Comments

@jace
Copy link

jace commented Jan 17, 2021

SQLAlchemy supports automatic type detection with foreign key columns:

class MyModel(Model):
    my_column = Column(None, ForeignKey('other_table.other_column'))

However this call variant is not present in the stubs. Mypy says:

error: No overload variant of "Column" matches argument types "None", "ForeignKey"  [call-overload]
note: Possible overload variants:
note:     def [_T] __init__(self, name: str, type_: Type[TypeEngine[_T]], *args: Any, autoincrement: Union[bool, str] = ..., default: Any = ..., doc: str = ..., key: str = ..., index: bool = ..., info: Mapping[str, Any] = ..., nullable: bool = ..., onupdate: Any = ..., primary_key: bool = ..., server_default: Any = ..., server_onupdate: Union[FetchedValue, FunctionElement[Any]] = ..., quote: Optional[bool] = ..., unique: bool = ..., system: bool = ..., comment: str = ...) -> Column[_T]
note:     def [_T] __init__(self, name: str, type_: TypeEngine[_T], *args: Any, autoincrement: Union[bool, str] = ..., default: Any = ..., doc: str = ..., key: str = ..., index: bool = ..., info: Mapping[str, Any] = ..., nullable: bool = ..., onupdate: Any = ..., primary_key: bool = ..., server_default: Any = ..., server_onupdate: Union[FetchedValue, FunctionElement[Any]] = ..., quote: Optional[bool] = ..., unique: bool = ..., system: bool = ..., comment: str = ...) -> Column[_T]
note:     <4 more similar overloads not shown, out of 6 total overloads>

This issue is distinct from #67 (Can't use ForeignKey in Column).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant