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

ColumnCollection initializer incorrect #227

Open
rectalogic opened this issue Oct 26, 2021 · 0 comments
Open

ColumnCollection initializer incorrect #227

rectalogic opened this issue Oct 26, 2021 · 0 comments

Comments

@rectalogic
Copy link

The example in the docs shows a list of tuples of name/column pairs:

>>> 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:

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)
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