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
When the connection builder adds OIDC auth, it delegates to a separate OIDC builder. When the OIDC builder completes, it returns a reference to the original connection builder which was stored as an instance variable on the OIDC builder instance.
This works fine when executing the Python, however static type checking fails because the type of the connection builder is not fixed. The connection builder is generally sub-classed, and so the connection builder type cannot be hard coded. The current implementation hardcodes the base connection builder class, which is incorrect if the connection builder has been sub-classed. As a result, the type returned by the completion of the OIDC builder is incorrect, which breaks intellisense in both PyCharm and VS Code.
TypeVars and/or overloads: These generally help in the case where a specific arg type is either the same type that should be returned, or maps to a specific return type. This doesn't apply here, because the oidc builder class is not subclassed, and therefore the self argument is unchanged
Delete type hints for the OIDC finalizing methods. In this case, the pylance and pycharm type checkers determine the returned type to be the base class, not the sub-class.
This results in a cxn object with the correct type.
The obvious drawback with this is that it requires some additional boilerplate code to be written by the end user. I can't see a way around this though; once the static typechecker hits .authorize(), the link to the bomanalytics code is broken for this statement. It can only be introduced by another statement that explicitly performs a cast.
When the connection builder adds OIDC auth, it delegates to a separate OIDC builder. When the OIDC builder completes, it returns a reference to the original connection builder which was stored as an instance variable on the OIDC builder instance.
This works fine when executing the Python, however static type checking fails because the type of the connection builder is not fixed. The connection builder is generally sub-classed, and so the connection builder type cannot be hard coded. The current implementation hardcodes the base connection builder class, which is incorrect if the connection builder has been sub-classed. As a result, the type returned by the completion of the OIDC builder is incorrect, which breaks intellisense in both PyCharm and VS Code.
See #40 for more details.
The text was updated successfully, but these errors were encountered: