-
Notifications
You must be signed in to change notification settings - Fork 6
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
remove bigquery dependency on Recordset #1192
Conversation
Reviewer's Guide by SourceryThis pull request removes the direct dependency on BigQuery in the Recordset class by replacing the type check with a more generic attribute check. Additionally, the library version has been incremented from 2.7.17 to 2.7.18. File-Level Changes
Tips
|
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.
Hey @phenobarbital - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a more generic attribute than 'job_id' for type checking, as this might be too specific to BigQuery.
- Please confirm that this change doesn't break existing behavior for code that may be relying on BigQuery-specific functionality.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -32,7 +32,8 @@ def get_result(self) -> Any: | |||
def from_result(cls, result: Iterator) -> "Recordset": | |||
cols = [] | |||
try: | |||
if isinstance(result, bigquery.table.RowIterator): | |||
# if isinstance(result, bigquery.table.RowIterator): | |||
if hasattr(result, 'job_id'): # BigQuery Row Iterator |
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.
suggestion: Consider adding a comment explaining the rationale for using hasattr instead of isinstance
While this change makes the check more flexible, it would be helpful to explain why hasattr is preferred over isinstance in this case. This will aid future maintainers in understanding the decision.
if hasattr(result, 'job_id'): # BigQuery Row Iterator | |
# Check if result is a BigQuery RowIterator without relying on specific class | |
# This allows for more flexibility with different BigQuery client versions | |
if hasattr(result, 'job_id'): # BigQuery Row Iterator |
Summary by Sourcery
Remove the direct dependency on BigQuery in the Recordset class by using a more generic attribute check, and update the library version to 2.7.18.
Enhancements:
Chores: