-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Feature/add quota project support #56324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/add quota project support #56324
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
@Ankurdeewan thank you for your PR! |
Thanks for the review @MaksYermak! On the placement side, I added support for That was the reasoning I went with, but of course happy to adjust if you feel it should be connection-only or if precedence should be handled differently. |
I would think that having it at the Operator level is beneficial since different operations in different areas of a google project can be billed differently. And google's API/CLI/SDKs support specifying the quota project at the call-level as well: https://cloud.google.com/docs/quotas/set-quota-project |
@adamides |
@Ankurdeewan Hi there!
|
yeah thanks @VladaZakharova for the detailed feedback, i went through all the points you mentioned. moved the tests into test_base_google.py (removed the old _system style), cleaned up the extra /common folder, moved the docs into gcp.rst, and added logic for the anonymous creds case too. just pushed everything, let me know if i missed something or if there’s a cleaner way to do any of these :) |
This commit implements quota project support for Google Cloud providers to allow specifying separate billing projects. The changes include: - Add quota_project_id parameter to GoogleBaseHook - Support setting quota project via connection extras - Add validation and error handling - Add comprehensive documentation and examples - Add unit tests - Add changelog entry The feature allows organizations to: - Bill API usage to different projects than the service account project - Configure billing at both connection and operator level - Maintain backward compatibility with existing setups Docs: Added quota_project.md with usage examples Tests: Added unit tests in test_quota_project.py
- Add proper validation for quota project IDs - Add detailed error messages and troubleshooting hints - Enhance test coverage with more test cases - Update documentation with clear examples
This change introduces the ability to set a quota project for Google Cloud API calls via the GoogleBaseHook. It includes validation, error handling, and skips quota project logic for anonymous credentials. The update improves flexibility for billing/quota management when using shared service accounts. All logic is covered by tests and documented as per reviewer feedback.
71dea16
to
ed7a956
Compare
Add quota/billing project support for Google Cloud providers
Currently, Airflow's Google Cloud providers lack support for specifying a quota/billing project when using Google services. This PR adds the ability to configure a separate project for API quota and billing purposes, which is particularly useful for organizations using shared service accounts.
Changes:
The quota project can be specified in two ways:
Via connection configuration (in extras):
"quota_project_id": "billing-project-123"
Via operator parameter:
task = BigQueryExecuteQueryOperator(
quota_project_id="billing-project-123",
...
)
The implementation uses Google Auth library's with_quota_project() method to properly set the x-goog-user-project header required by Google Cloud APIs.
Testing:
Documentation has been updated to reflect the new functionality.
Closes: #56311