Skip to content

Commit 2653b37

Browse files
committed
Rename kaggle.py to kaggle_gcp.py which will then be imported into the kaggle namespace by the Worker.
1 parent fba9b05 commit 2653b37

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ RUN pip install --upgrade dask && \
505505

506506
# Add BigQuery client proxy settings
507507
ENV PYTHONUSERBASE "/root/.local"
508-
ADD patches/kaggle.py /root/.local/lib/python3.6/site-packages/kaggle.py
508+
ADD patches/kaggle_gcp.py /root/.local/lib/python3.6/site-packages/kaggle_gcp.py
509509
ADD patches/sitecustomize.py /root/.local/lib/python3.6/site-packages/sitecustomize.py
510510

511511
# Set backend for matplotlib
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ class PublicBigqueryClient(bigquery.client.Client):
3838
client = PublicBigqueryClient()
3939
"""
4040

41-
def __init__(self, project=None):
42-
if project:
43-
raise Exception("In order to query a private BigQuery project, please connect a GCP account. "
44-
"Otherwise do not specify a project to use Kaggle's public dataset BigQuery integration.")
41+
def __init__(self):
4542
data_proxy_project = os.getenv("KAGGLE_DATA_PROXY_PROJECT")
4643
anon_credentials = credentials.AnonymousCredentials()
4744
anon_credentials.refresh = lambda *args: None

patches/sitecustomize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from google.auth import credentials
77
from google.cloud import bigquery
88
from google.cloud.bigquery._http import Connection
9-
from kaggle import PublicBigqueryClient
9+
from kaggle_gcp import PublicBigqueryClient
1010

1111
def monkeypatch_bq(bq_client, *args, **kwargs):
1212
data_proxy_project = os.getenv("KAGGLE_DATA_PROXY_PROJECT")

tests/test_bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from google.cloud import bigquery
1010
from google.auth.exceptions import DefaultCredentialsError
11-
from kaggle import KaggleKernelCredentials, PublicBigqueryClient
11+
from kaggle_gcp import KaggleKernelCredentials, PublicBigqueryClient
1212

1313

1414
class TestBigQuery(unittest.TestCase):

0 commit comments

Comments
 (0)