Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion external/mypy
Submodule mypy updated 479 files
9 changes: 5 additions & 4 deletions sqlalchemy-stubs/sql/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ class ForeignKeyConstraint(ColumnCollectionConstraint):
use_alter: bool = ...
match: Optional[str] = ...
elements: List[ForeignKey] = ...
def __init__(self, columns: SequenceType[str], refcolumns: SequenceType[Union[str, Column[Any]]], name: Optional[str] = ...,
onupdate: Optional[str] = ..., ondelete: Optional[str] = ..., deferrable: Optional[bool] = ...,
initially: Optional[str] = ..., use_alter: bool = ..., link_to_name: bool = ..., match: Optional[str] = ...,
table: Optional[Table] = ..., info: Optional[Mapping[str, Any]] = ..., **dialect_kw: Any) -> None: ...
def __init__(self, columns: SequenceType[Union[str, Column[Any]]], refcolumns: SequenceType[Union[str, Column[Any]]],
name: Optional[str] = ..., onupdate: Optional[str] = ..., ondelete: Optional[str] = ...,
deferrable: Optional[bool] = ..., initially: Optional[str] = ..., use_alter: bool = ...,
link_to_name: bool = ..., match: Optional[str] = ..., table: Optional[Table] = ...,
info: Optional[Mapping[str, Any]] = ..., **dialect_kw: Any) -> None: ...
@property
def referred_table(self) -> Table: ...
@property
Expand Down
2 changes: 0 additions & 2 deletions sqlalchemy-stubs/util/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ from .compat import (
cpython as cpython,
win32 as win32,
pickle as pickle,
dottedgetter as dottedgetter,
parse_qsl as parse_qsl,
namedtuple as namedtuple,
next as next,
Expand All @@ -35,7 +34,6 @@ from .compat import (
unquote as unquote,
b64decode as b64decode,
b64encode as b64encode,
byte_buffer as byte_buffer,
itertools_filter as itertools_filter,
iterbytes as iterbytes,
StringIO as StringIO,
Expand Down
35 changes: 35 additions & 0 deletions test/test-data/sqlalchemy-sql-schema.test
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,38 @@ test_table = Table('test', metadata,
Index('idx1', 'id', text("lower(name)")),
)
[out]

[case testColumnWithForeignKeyThroughTableArgsAsColumn]
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKeyConstraint, Integer

Base = declarative_base()

class Profile(Base):
__tablename__ = "profile"
id = Column(Integer, primary_key=True)

class User(Base):

__tablename__ = "user"
artkey = Column(Integer, primary_key=True)
profile_id = Column(Integer, nullable=False)
__table_args__ = (ForeignKeyConstraint([profile_id], [Profile.id]), )
[out]

[case testColumnWithForeignKeyThroughTableArgsAsString]
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKeyConstraint, Integer

Base = declarative_base()

class Profile(Base):
__tablename__ = "profile"
id = Column(Integer, primary_key=True)

class User(Base):
__tablename__ = "user"
id = Column(Integer, primary_key=True)
profile_id = Column(Integer, nullable=False)
__table_args__ = (ForeignKeyConstraint(["profile_id"], [Profile.id]), )
[out]