-
Notifications
You must be signed in to change notification settings - Fork 41
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
Confused on Stubs providing type hints for Table constructor #229
Labels
question
Further information is requested
Comments
CaselIT
added
question
Further information is requested
and removed
requires triage
New issue that requires categorization
labels
Sep 8, 2022
Hi, The current version of the stubs is alpha, and it's unlikely it will improve much, since work is now focussed on integrating the types into the sqlalchemy code for version 2. We are aware that the current story with typing is not great, but we are confident that sqlalchemy v2 will improve things a lot. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe your question
I'm a new user to SQLAlchemy and I'm confused on the current state of stubs. Using the pylance/typeshed stubs as well as the dropbox stubs give me issues when following the official documentation (like, from sqlalchemy.orm import Session, declarative_base, says that declarative_base is not part of the package), and when reading the documentation, it suggests to use this package, which is fine and I get it all working, but when I am hovering over an instance of Table from sqlalchemy.schema, it gives me the constructor information of:
While the stubs from sqlalchemy-stubs gives me:
So, the stubs from sqlalchemy-stubs give me type hinting for the arguments for Table, and the ones for this package do not. Is this intentional?
Also, when it is asking me to see the top-level documentation for _schema.Table, where am I supposed to look, and how can I see this in code? How can I have this package give me an error when I supply incorrect arguments to a table constructor (like its supposed to), or is this some sort of regression when compared to the other packages? I'm sure I'm just not understanding, and I'd love to make an update to the docs for this plugin if it's just something I'm not getting.
I got to this point by following the core tutorial up until the metadata section - https://docs.sqlalchemy.org/en/14/tutorial/metadata.html#setting-up-metadata-with-table-objects
Example
Versions
Additional context
I'm using vscode
The text was updated successfully, but these errors were encountered: