Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: in-operator literal binds not handled properly #285


Copy link

@jimfulton jimfulton commented Aug 19, 2021

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #252 馃

jimfulton added 5 commits Aug 19, 2021
鈥om:jimfulton/python-bigquery-sqlalchemy into literal_binds_kwarg_with_an_IN_operator_252
and added unit test to cover it.

Also fixed constraints
@jimfulton jimfulton closed this Aug 19, 2021
@jimfulton jimfulton deleted the literal_binds_kwarg_with_an_IN_operator_252 branch Aug 19, 2021
@jimfulton jimfulton restored the literal_binds_kwarg_with_an_IN_operator_252 branch Aug 20, 2021
@jimfulton jimfulton reopened this Aug 20, 2021
@jimfulton jimfulton marked this pull request as ready for review Aug 20, 2021
@jimfulton jimfulton requested a review from as a code owner Aug 20, 2021
Copy link
Contributor Author

@jimfulton jimfulton commented Aug 23, 2021


This PR boils down to this line:

Normally, IN SQLAlchemy, when you pass values from Python, the values are passes as parameters. We override a methid, visit_bindparam, that controls this. For BQ, which is picky about types, we do this so we can pass type information to BQ.

OTOH, for "literal" binds, values get knit into the SQL and aren't passes as parameters to the DB API. In this case, we can just call the base method and be done.

tswast approved these changes Aug 23, 2021
@jimfulton jimfulton merged commit e06bf74 into googleapis:master Aug 23, 2021
9 checks passed
@jimfulton jimfulton deleted the literal_binds_kwarg_with_an_IN_operator_252 branch Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants