Skip to content

Commit 20c1d95

Browse files
authored
Merge branch 'main' into output_schema
2 parents 378ebe4 + d97cafc commit 20c1d95

File tree

497 files changed

+26719
-11082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

497 files changed

+26719
-11082
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ system_tests/local_test_setup
6262
# Make sure a generated file isn't accidentally committed.
6363
pylintrc
6464
pylintrc.test
65+
dummy.pkl

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
hooks:
2121
- id: trailing-whitespace
2222
- id: end-of-file-fixer
23-
exclude: "^tests/unit/core/compile/sqlglot/snapshots"
23+
exclude: "^tests/unit/core/compile/sqlglot/.*snapshots"
2424
- id: check-yaml
2525
- repo: https://github.com/pycqa/isort
2626
rev: 5.12.0

CHANGELOG.md

Lines changed: 148 additions & 1 deletion
Large diffs are not rendered by default.

bigframes/_config/bigquery_options.py

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import google.auth.credentials
2323
import requests.adapters
2424

25-
import bigframes._config.auth
2625
import bigframes._importing
2726
import bigframes.enums
2827
import bigframes.exceptions as bfe
@@ -38,7 +37,6 @@
3837

3938
def _get_validated_location(value: Optional[str]) -> Optional[str]:
4039
import bigframes._tools.strings
41-
import bigframes.constants
4240

4341
if value is None or value in bigframes.constants.ALL_BIGQUERY_LOCATIONS:
4442
return value
@@ -143,52 +141,20 @@ def application_name(self, value: Optional[str]):
143141
)
144142
self._application_name = value
145143

146-
def _try_set_default_credentials_and_project(
147-
self,
148-
) -> tuple[google.auth.credentials.Credentials, Optional[str]]:
149-
# Don't fetch credentials or project if credentials is already set.
150-
# If it's set, we've already authenticated, so if the user wants to
151-
# re-auth, they should explicitly reset the credentials.
152-
if self._credentials is not None:
153-
return self._credentials, self._project
154-
155-
(
156-
credentials,
157-
credentials_project,
158-
) = bigframes._config.auth.get_default_credentials_with_project()
159-
self._credentials = credentials
160-
161-
# Avoid overriding an explicitly set project with a default value.
162-
if self._project is None:
163-
self._project = credentials_project
164-
165-
return credentials, self._project
166-
167144
@property
168-
def credentials(self) -> google.auth.credentials.Credentials:
145+
def credentials(self) -> Optional[google.auth.credentials.Credentials]:
169146
"""The OAuth2 credentials to use for this client.
170147
171-
Set to None to force re-authentication.
172-
173148
Returns:
174149
None or google.auth.credentials.Credentials:
175150
google.auth.credentials.Credentials if exists; otherwise None.
176151
"""
177-
if self._credentials:
178-
return self._credentials
179-
180-
credentials, _ = self._try_set_default_credentials_and_project()
181-
return credentials
152+
return self._credentials
182153

183154
@credentials.setter
184155
def credentials(self, value: Optional[google.auth.credentials.Credentials]):
185156
if self._session_started and self._credentials is not value:
186157
raise ValueError(SESSION_STARTED_MESSAGE.format(attribute="credentials"))
187-
188-
if value is None:
189-
# The user has _explicitly_ asked that we re-authenticate.
190-
bigframes._config.auth.reset_default_credentials_and_project()
191-
192158
self._credentials = value
193159

194160
@property
@@ -217,11 +183,7 @@ def project(self) -> Optional[str]:
217183
None or str:
218184
Google Cloud project ID as a string; otherwise None.
219185
"""
220-
if self._project:
221-
return self._project
222-
223-
_, project = self._try_set_default_credentials_and_project()
224-
return project
186+
return self._project
225187

226188
@project.setter
227189
def project(self, value: Optional[str]):

bigframes/bigquery/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
json_value,
5252
json_value_array,
5353
parse_json,
54+
to_json,
5455
to_json_string,
5556
)
5657
from bigframes.bigquery._operations.search import create_vector_index, vector_search
@@ -89,6 +90,7 @@
8990
json_value,
9091
json_value_array,
9192
parse_json,
93+
to_json,
9294
to_json_string,
9395
# search ops
9496
create_vector_index,

0 commit comments

Comments
 (0)