GeezerVison is showing github.com — feat: allow cell magic body to be a $variable by plamut · Pull Request #1053 · googleapis/python-bigquery
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Conversation
Closes #1040.
Thought - we probably want to follow up with a sample demonstrating this new use case.
Also, the length of the _cell_magic() function should be ignored for now, it's been waiting to be split into smaller units since forever. 🙂
PR checklist:
- 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)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.
ℹ️ Googlers: Go here for more info.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
google-cla
Bot
added
cla: no
This human has *not* signed the Contributor License Agreement.
and removed
cla: yes
This human has signed the Contributor License Agreement.
labels
Nov 8, 2021
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.
ℹ️ Googlers: Go here for more info.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
OK, I'll edit the commit message then to silence the bot.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
google-cla
Bot
added
cla: yes
This human has signed the Contributor License Agreement.
and removed
cla: no
This human has *not* signed the Contributor License Agreement.
labels
Nov 8, 2021
|
|
cell_body = "$custom_query"
|
|
|
|
|
|
with pytest.raises(
|
|
|
NameError, match=r".*custom_query does not exist.*"
|
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.
Maybe comment to indicate we're testing the first kind of error, as I got the regex string match from context of the other file.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
plamut
Nov 10, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.
The name of the test explains which case it covers ("non-existing query variable"), do you think that's not sufficient by itself?
I always look at the name of the test first, although it might be just how my brain is wired...
Update: Added a comment next to the assignment to cell_body to explain which use case it targets.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
LGTM - I really like how you added the "non-existing query variable" condition.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
plamut reacted with heart emoji
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.
LGTM - could do with more comments on test cases, perhaps.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
cell_body = "$custom_query"
|
|
|
|
|
|
with pytest.raises(
|
|
|
TypeError, match=r".*must be a string or a bytes-like.*"
|
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.
Might be good to have another comment here to match it to the other else condition in run_query_magic
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
LGTM - appreciate the changes!!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
abdelmegahedgoogle
pushed a commit
to abdelmegahedgoogle/python-bigquery
that referenced
this pull request
Apr 17, 2023
* feat: allow cell magic body to be a $variable
* Fix missing indefinitive article in error msg
* Adjust test assertion to error message change
* Refactor logic for extracting query variable
* Explicitly warn about missing query variable name
* Thest the query "variable" is not identifier case
Reviewers
2 more reviewers
tseaver
tseaver approved these changes
loferris
loferris approved these changes
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Labels
api: bigquery
Issues related to the googleapis/python-bigquery API.
cla: yes
This human has signed the Contributor License Agreement.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|