Skip to content

Commit 53d99a1

Browse files
committed
PR comments
1 parent 0a4e1b4 commit 53d99a1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pyiceberg/catalog/bigquery_metastore.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
if TYPE_CHECKING:
4444
import pyarrow as pa
4545

46-
GCP_PROJECT_ID = "gcp.project-id"
47-
GCP_LOCATION = "gcp.location"
48-
GCP_CREDENTIALS_LOCATION = "gcp.credentials-location"
49-
GCP_CREDENTIALS_INFO = "gcp.credentials-info"
46+
GCP_PROJECT_ID = "gcp.bigquery.project-id"
47+
GCP_LOCATION = "gcp.bigquery.location"
48+
GCP_CREDENTIALS_FILE = "gcp.bigquery.credential-file"
49+
GCP_CREDENTIALS_INFO = "gcp.bigquery.credentials-info"
5050

5151
METADATA_LOCATION_PROP = "metadata_location"
5252
PREVIOUS_METADATA_LOCATION_PROP = "previous_metadata_location"
@@ -64,7 +64,7 @@ def __init__(self, name: str, **properties: str):
6464

6565
project_id: Optional[str] = self.properties.get(GCP_PROJECT_ID)
6666
location: Optional[str] = self.properties.get(GCP_LOCATION)
67-
credentials_location: Optional[str] = self.properties.get(GCP_CREDENTIALS_LOCATION)
67+
credentials_file: Optional[str] = self.properties.get(GCP_CREDENTIALS_FILE)
6868
credentials_info_str: Optional[str] = self.properties.get(GCP_CREDENTIALS_INFO)
6969

7070
if not project_id:
@@ -74,9 +74,12 @@ def __init__(self, name: str, **properties: str):
7474
if not Config().get_bool("legacy-current-snapshot-id"):
7575
raise ValueError("legacy-current-snapshot-id must be enabled to work with BigQuery.")
7676

77+
if credentials_file and credentials_info_str:
78+
raise ValueError("Cannot specify both `gcp.bigquery.credentials-file` and `gcp.bigquery.credentials-info`")
79+
7780
gcp_credentials = None
78-
if credentials_location:
79-
gcp_credentials = service_account.Credentials.from_service_account_file(credentials_location)
81+
if credentials_file:
82+
gcp_credentials = service_account.Credentials.from_service_account_file(credentials_file)
8083
elif credentials_info_str:
8184
try:
8285
credentials_info_dict = json.loads(credentials_info_str)

0 commit comments

Comments
 (0)