You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Table(*args: Any, **kw: Any)
Constructor for _schema.Table.
This method is a no-op. See the top-level documentation for _schema.Table for constructor arguments.
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.
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.
PR are welcome to improve the many rough edges though
We are aware that the current story with typing is not great, but we are confident that sqlalchemy v2 will improve things a lot.
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: