MCPcopy Create free account
hub / github.com/Kaggle/docker-python / PublicBigqueryClient

Class PublicBigqueryClient

patches/kaggle_gcp.py:108–124  ·  view source on GitHub ↗

A modified BigQuery client that routes requests using Kaggle's Data Proxy to provide free access to Public Datasets. Example usage: from kaggle import PublicBigqueryClient client = PublicBigqueryClient()

Source from the content-addressed store, hash-verified

106
107
108class PublicBigqueryClient(bigquery.client.Client):
109 """A modified BigQuery client that routes requests using Kaggle's Data Proxy to provide free access to Public Datasets.
110 Example usage:
111 from kaggle import PublicBigqueryClient
112 client = PublicBigqueryClient()
113 """
114
115 def __init__(self, *args, **kwargs):
116 data_proxy_project = os.getenv("KAGGLE_DATA_PROXY_PROJECT")
117 default_api_endpoint = os.getenv("KAGGLE_DATA_PROXY_URL")
118 anon_credentials = credentials.AnonymousCredentials()
119 anon_credentials.refresh = lambda *args: None
120 super().__init__(
121 project=data_proxy_project, credentials=anon_credentials, *args, **kwargs
122 )
123 # TODO: Remove this once https://github.com/googleapis/google-cloud-python/issues/7122 is implemented.
124 self._connection = _DataProxyConnection(self, api_endpoint=default_api_endpoint)
125
126def has_been_monkeypatched(method):
127 return "kaggle_gcp" in inspect.getsourcefile(method)

Callers 2

monkeypatch_bqFunction · 0.90

Calls

no outgoing calls

Tested by 1