-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
Fix SQL parameter type #757
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that illustrates why this is needed, i.e., why the current types for the params
argument don't work?
Hi! Thanks for getting back quickly! I'm not quite sure how to test this change. Eventually we are calling into SQLAlchemy when using these methods - and SQLAlchemy types the parameters as |
If you look at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In thinking about this, I think the Any
type is too wide. For example, you couldn't pass an instance of any class as a parameter to an SQL call, it would have to be some kind of scalar. So can you change the places where you used Any
in this PR to use Scalar
instead, which you can import from pandas._typing
?
Sounds like a good solution to me. I've made the change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Tolker-KU
Align parameter type to SQL functions: https://github.com/pandas-dev/pandas/blob/main/pandas/io/sql.py#L370
assert_type()
to assert the type of any return value