Closed mark-thm closed 3 weeks ago
Mark Elliot has proposed a fix for this issue in the main branch:
Add overload for ColumnCollection.get(col, default) https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5286
Mark Elliot has proposed a fix for this issue in the rel_2_0 branch:
Add overload for ColumnCollection.get(col, default) https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5289
Ensure stubs packages are not installed
sqlalchemy-stubs
andsqlalchemy2-stubs
are not compatible with v2)Verify if the api is typed
Describe the typing issue
ColumnCollection.get(column, default) returns an Optional even when a default is specified, but the return is non-None when default is specified.
To Reproduce
Error
No error — the typings result in .get returning an Optional
Versions
Additional context
https://github.com/sqlalchemy/sqlalchemy/blob/046ebffed77aff2f5e039763af4a3eb8a122c9c8/lib/sqlalchemy/sql/base.py#L1644 should likely have an overload for when default is present.