sqlalchemy2-stubs
sqlalchemy2-stubs copied to clipboard
Consider changing typing generics to python literals instead of TypeEngine
This issue is a placeholder for now so I don't forget, I'll write some examples of problems we cannot easily type using stubs only in the coming days.
just to put my 2c in, when i first looked at sqlalhcemy-stubs it felt really wrong that we have this notion of ColumnElement[int] . ColumnElement knows nothing about ints, it knows about the TypeEngine, and I dont think it's possilble right now to remove that without rewriting the whole mypy plugin and breaking compatibility. if pep-484 has no way to handle two levels of indirection here that is kind of unfortunate.
maybe if we could make it two types, as an admittedly ugly workaround for pep-484 limitations, e.g. ColumnElement[Integer, int]. that would really suck. so I just need to see exactly how this limitation is manitesting and if it would be fixed by new typing features that are still in development upstream.