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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove bigquery dependency on Recordset #1192

Merged
merged 1 commit into from
Aug 7, 2024
Merged

Conversation

phenobarbital
Copy link
Owner

@phenobarbital phenobarbital commented Aug 7, 2024

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:

  • Remove direct dependency on BigQuery in Recordset by using a more generic attribute check.

Chores:

  • Bump version number from 2.7.17 to 2.7.18.

@phenobarbital phenobarbital merged commit b544c7e into master Aug 7, 2024
2 checks passed
@phenobarbital phenobarbital deleted the refactor-2.7-scylladb branch August 7, 2024 16:49
Copy link
Contributor

sourcery-ai bot commented Aug 7, 2024

Reviewer's Guide by Sourcery

This 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

Files Changes
asyncdb/meta/recordset.py
asyncdb/version.py
Removed the direct dependency on BigQuery in Recordset and updated the library version.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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
Copy link
Contributor

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.

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant