joyhaldar commented on code in PR #14447: URL: https://github.com/apache/iceberg/pull/14447#discussion_r2631135321
########## bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryProperties.java: ########## @@ -0,0 +1,165 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.gcp.bigquery; + +import com.google.auth.oauth2.GoogleCredentials; +import com.google.auth.oauth2.ImpersonatedCredentials; +import com.google.cloud.ServiceOptions; +import com.google.cloud.bigquery.BigQueryOptions; +import java.io.IOException; +import java.io.Serializable; +import java.io.UncheckedIOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; +import org.apache.iceberg.relocated.com.google.common.base.Preconditions; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class BigQueryProperties implements Serializable { + + private static final Logger LOG = LoggerFactory.getLogger(BigQueryProperties.class); + + // User provided properties. + public static final String PROJECT_ID = "gcp.bigquery.project-id"; + public static final String GCP_LOCATION = "gcp.bigquery.location"; + public static final String LIST_ALL_TABLES = "gcp.bigquery.list-all-tables"; + + // Service account impersonation properties. + public static final String IMPERSONATE_SERVICE_ACCOUNT = "gcp.impersonate.service-account"; + public static final String IMPERSONATE_LIFETIME_SECONDS = "gcp.impersonate.lifetime-seconds"; + public static final String IMPERSONATE_SCOPES = "gcp.impersonate.scopes"; + public static final String IMPERSONATE_DELEGATES = "gcp.impersonate.delegates"; Review Comment: Thank you for the feedback Daniel. On property naming, my original thinking was to follow AWS's pattern where `client.assume-role.arn` applies to both Glue and S3. That's why I had a single shared property: ```gcp.impersonate.service-account``` read by both BigQuery and GCS. Separate properties would look like: ```gcp.bigquery.impersonate.service-account gcs.impersonate.service-account``` Separate properties would give more control over Service Accounts and scopes for metastore vs storage independently. The tradeoff is users must configure both even for the common case of using the same Service Account. If only one is set, metadata operations might work but data access fails (or vice versa), which could be harder to debug. This is why AWS went with a single shared property (if I understand correctly, please correct me if I am wrong). I'd appreciate your thoughts on which approach makes more sense here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
