My experience is this is nearly impossible, the solution is new packages written after typing was introduced.
I don’t know about SQLAlchemy, but for libraries like pandas I just don’t see how it can be done, and so people are actively replacing them with modern typed alternatives