Skip to content
Merged
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
6 changes: 3 additions & 3 deletions sqlalchemy-stubs/sql/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing import (
)
from . import visitors, functions
from .base import SchemaEventTarget as SchemaEventTarget, DialectKWArgs as DialectKWArgs, ColumnCollection
from .elements import ColumnClause as ColumnClause
from .elements import ColumnClause as ColumnClause, TextClause
from .selectable import TableClause as TableClause
from .type_api import TypeEngine
from .. import util
Expand Down Expand Up @@ -304,8 +304,8 @@ class Index(DialectKWArgs, ColumnCollectionMixin, SchemaItem):
name: str = ...
unique: bool = ...
info: Optional[Mapping[str, Any]] = ...
def __init__(self, name: str, *expressions: Union[Column[Any], str], unique: bool = ..., quote: Optional[bool] = ...,
info: Optional[Mapping[str, Any]] = ..., **kw: Any) -> None: ...
def __init__(self, name: str, *expressions: Union[TextClause, Column[Any], str], unique: bool = ...,
quote: Optional[bool] = ..., info: Optional[Mapping[str, Any]] = ..., **kw: Any) -> None: ...
@property
def bind(self) -> Optional[Union[Engine, Connection]]: ...
def create(self: _I, bind: Optional[Union[Engine, Connection]] = ...) -> _I: ...
Expand Down
14 changes: 14 additions & 0 deletions test/test-data/sqlalchemy-sql-schema.test
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ class Mytable(Base):
__tablename__ = 'mytable'
objid = Column(ForeignKey('othertable.objid'), index=True)
[out]

[case testTableWithIndexes]
from sqlalchemy import Column, Table, String, Integer, Index, MetaData, text, func
metadata = MetaData()
name_col = Column('name', String)
test_table = Table('test', metadata,
Column('id', Integer, primary_key=True),
name_col,
Index('idx1', 'id', 'name'),
Index('idx1', 'id', name_col),
Index('idx1', 'id', func.lower(name_col)),
Index('idx1', 'id', text("lower(name)")),
)
[out]