FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add message to user when they use private bigquery without project id… by vimota · Pull Request #591 · Kaggle/docker-python · GitHub

Add message to user when they use private bigquery without project id… - #591

Merged
vimota merged 2 commits into
masterfrom
projectid
Aug 1, 2019
Merged

vimota merged 2 commits into
masterfrom
projectid

Conversation

vimota commented Jul 24, 2019 •
edited
Loading

Copy link
Copy Markdown
Contributor

… which will cause a DefaultCredentialsError. Additionally, it ensures that we only monkeypatch the desired module methods once, to avoid double wrapping the methods.

b/138330551

vimota requested review from ifigotin and rosbo July 24, 2019 23:41

rosbo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Could you add a test cases for this code path?

vimota commented Jul 25, 2019

Copy link
Copy Markdown
Contributor Author

@rosbo I thought about that but this change is only a logging/print() change so I'm not sure how to effectively test for it? Should I mock print?

rosbo commented Jul 25, 2019

Copy link
Copy Markdown
Contributor

True, it's probably fine as-is. :)

ifigotin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

vimota commented Aug 1, 2019

Copy link
Copy Markdown
Contributor Author

Sorry to revive this PR, but I realized on testing this that the print message was appearing twice and the stack trace looked like the monkeypatching was monkeypatching the already monkeypatched (tongue-twister :) method. I believe this happens because during import of bigquery/gcs the GCPLoader imports sitecustomize (which monkeypatches it the first time) and then calls kaggle_gcp.init_bigquery to return the module, which monkeypatches it again. To be safe, I added a check during the monkeypatching to avoid wrapping an already monkeypatched method (bigquery.Client() or storage.Client.init).

The unit tests I added repro this, and was able to confirm it worked correctly in the Kernel.

vimota requested review from ifigotin and rosbo August 1, 2019 07:02

ifigotin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

I assume this change doesn't significantly slow things down.

vimota merged commit d2a38d5 into master Aug 1, 2019
rosbo deleted the projectid branch December 10, 2019 01:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL