phanikumv commented on code in PR #65499:
URL: https://github.com/apache/airflow/pull/65499#discussion_r3110073673


##########
providers/google/src/airflow/providers/google/cloud/hooks/bigquery.py:
##########
@@ -96,6 +97,21 @@
 
 BigQueryJob = CopyJob | QueryJob | LoadJob | ExtractJob
 

Review Comment:
   There's a naming convention mismatch between the two uses of `fields` in 
this method:
   
   1. The user-facing `fields` parameter (and the merge loop) correctly uses 
**camelCase REST API names** (e.g. `"definitionBody"`, `"routineType"`).
   2. `_ROUTINE_WRITABLE_PROPERTIES` uses **Python SDK attribute names** (e.g. 
`"body"`, `"type_"`) — these are passed as the `fields` argument to 
`client.update_routine()`.
   
   According to the [BigQuery Python SDK 
source](https://github.com/googleapis/python-bigquery/blob/main/google/cloud/bigquery/client.py),
 `client.update_routine(routine, fields)` passes `fields` directly into the 
REST update mask, which expects REST API names (camelCase). Passing Python 
attribute names like `"body"` and `"type_"` may result in the update mask being 
silently ignored by the API, making every call a full resource replace 
regardless of `fields`.
   
   Additionally, the user-facing `fields` parameter has no validation against 
known camelCase names — passing `"body"` (Python name) instead of 
`"definitionBody"` would silently skip the update (field not found in 
`updates_repr`) and clear the field on the server instead.
   
   Suggest either:
   - Changing `_ROUTINE_WRITABLE_PROPERTIES` to use camelCase REST names to 
match what `client.update_routine()` expects, or
   - Adding explicit input validation for the user-facing `fields` parameter 
against a set of known valid camelCase API names.



-- 
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]

Reply via email to