Skip to content

Conversation

@rambleraptor
Copy link
Contributor

Rationale for this change

Matches this Java PR

Google's authentication for BigQuery involves using different authentication methods than the current AuthManagers support. This allows users to authenticate against the BigLake REST Catalog (formerly known as the BigQuery REST Catalog)

The GoogleAuthManager introduces authentication methods that are more convenient for GCP users, differing from the generic OAuth2 flow:

  • Application Default Credentials (ADC) Support: Provides out-of-the-box, zero-configuration authentication when the Iceberg client runs within GCP environments (e.g., Compute Engine, GKE, Cloud Functions). This is a significant usability improvement over manually setting up OAuth2 parameters.
  • Service Account Key File Support: Allows users to authenticate by directly providing a path to a GCP service account JSON key file. This is a common and secure way to authenticate applications with GCP services, and is more specific than the generic token or client secret mechanisms.
  • Configurable OAuth Scopes: While the generic OAuth2Manager also supports scopes, GoogleAuthManager defaults to scopes commonly used for GCP services and allows easy customization via the gcp.auth.scopes property.

Are these changes tested?

Unit tests included.

Are there any user-facing changes?

Adds support for Google authentication

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this @rambleraptor 🙌

I'm not too familiar with the Google Auth system. WDYT @talatuyarer?

@Fokko Fokko requested a review from sungwy June 10, 2025 09:37
@talatuyarer
Copy link

I'm not too familiar with the Google Auth system. WDYT @talatuyarer?

Let me try the PR on my local machine @Fokko

@Fokko
Copy link
Contributor

Fokko commented Jul 3, 2025

@talatuyarer Any luck? :)

@talatuyarer
Copy link

@rambleraptor Could you update your PR with latest master changes

@rambleraptor
Copy link
Contributor Author

@talatuyarer changes updated to main branch!

@kevinjqliu kevinjqliu requested a review from Copilot July 25, 2025 22:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Google authentication support to the Iceberg Python client by implementing a GoogleAuthManager class, matching functionality from a corresponding Java PR. The implementation provides convenient authentication methods for GCP users including Application Default Credentials (ADC) support and service account key file authentication.

  • Implements GoogleAuthManager with support for default credentials and service account key files
  • Adds comprehensive unit tests covering different authentication scenarios
  • Configures optional google-auth dependency and mypy settings

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
pyiceberg/catalog/rest/auth.py Implements GoogleAuthManager class with Google authentication support
tests/catalog/test_rest_auth.py Adds comprehensive unit tests for GoogleAuthManager functionality
pyproject.toml Adds optional google-auth dependency and mypy configuration

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (and to copilot)

@kevinjqliu kevinjqliu requested a review from talatuyarer July 25, 2025 23:23
@kevinjqliu
Copy link
Contributor

@talatuyarer could you take another look before I merge?

@kevinjqliu
Copy link
Contributor

@rambleraptor looks like there a merge conflict with main

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @rambleraptor

Copy link

@talatuyarer talatuyarer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rambleraptor I tested this PR. It is working as expected. Please update documentation. Beside of that LGTM!

rambleraptor and others added 7 commits August 4, 2025 13:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rambleraptor
Copy link
Contributor Author

@Fokko @kevinjqliu @talatuyarer docs updated + merge conflict removed!

Copy link
Collaborator

@sungwy sungwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome work @rambleraptor ! I'm running the CI, I will merge it once the CI passes

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

self._auth_request = google.auth.transport.requests.Request()

def auth_header(self) -> str:
self.credentials.refresh(self._auth_request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this .refresh called on every request?

@sungwy sungwy merged commit 632d783 into apache:main Aug 4, 2025
11 checks passed
gabeiglio pushed a commit to Netflix/iceberg-python that referenced this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants