alamashir opened a new pull request, #65499:
URL: https://github.com/apache/airflow/pull/65499
## Summary
Adds first-class Airflow operators for BigQuery routines (user-defined
functions, stored procedures, table-valued and aggregate functions), so DAGs
can own their routine definitions declaratively instead of embedding `CREATE
FUNCTION` / `CREATE PROCEDURE` DDL inside `BigQueryInsertJobOperator`.
**New operators**
(`providers/google/src/airflow/providers/google/cloud/operators/bigquery.py`):
- `BigQueryCreateRoutineOperator` — creates any routine type; `if_exists` of
`fail` | `skip` | `replace`
- `BigQueryUpdateRoutineOperator` — PATCH with explicit field mask
- `BigQueryDeleteRoutineOperator` — `ignore_if_missing` toggle
- `BigQueryGetRoutineOperator` — pushes the serialized `Routine` resource to
XCom
- `BigQueryListRoutinesOperator` — dataset-scoped list via XCom
**New sensor** (`sensors/bigquery.py`):
- `BigQueryRoutineExistenceSensor`
**New hook methods** on `BigQueryHook`: `create_routine`, `update_routine`,
`delete_routine`, `get_routine`, `list_routines`. They wrap
`google-cloud-bigquery`'s existing routine client APIs — **no new provider
dependency**.
**Docs**: new `bigquery_routines.rst` guide with per-routine-type examples,
cross-linked from `bigquery.rst`.
**System test**: `example_bigquery_routines.py` exercises the full lifecycle
(create scalar UDF / procedure / TVF → sensor → update → get → list → delete).
**Unit tests**: 24 tests covering success, failure and edge cases (e.g.
`if_exists` branches, missing `routineReference`, `not_found_ok`).
Related: #47579
## Test plan
- [x] `uv run --project providers/google pytest
providers/google/tests/unit/google/cloud/{hooks,operators,sensors}/test_bigquery.py
-k Routine` — 24 passed
- [x] `ruff format` + `ruff check` clean on all touched files
- [ ] System test (`example_bigquery_routines.py`) — requires a live GCP
project; not run in this branch
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Opus 4.7 (Claude Code)
Generated-by: Claude Opus 4.7 (Claude Code) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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]