dropbox / dropbox/sqlalchemy-stubs

ColumnCollection initializer incorrect

Open
#227 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
583
Forks
96
PR merge metrics
No merged PRs in 30d

Description

The example in the docs shows a list of tuples of name/column pairs:
```pycon
>>> x1, x2 = Column('x', Integer), Column('x', Integer)
>>> cc = ColumnCollection(columns=[(x1.name, x1), (x2.name, x2)])
```
https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.ColumnCollection

But that fails to validate:
```python
import sqlalchemy as sa

t = sa.Table(
"foo", sa.MetaData(),
sa.Column("one", sa.Integer),
sa.Column("two", sa.Integer),
)
sa.sql.expression.ColumnCollection([
(t.c.one.name, t.c.one),
(t.c.two.name, t.c.two),
])
```

```
$ mypy cc.py
cc.py:8: error: Argument 1 to "ColumnCollection" has incompatible type "List[Tuple[str, Column[Any]]]"; expected "Column[Any]"
Found 1 error in 1 file (checked 1 source file)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.