X33834 opened a new pull request, #73099: URL: https://github.com/apache/airflow/pull/73099
### Problem Closes: #73091 `BigQueryHook.create_table()`'s `table_resource` parameter is typed and documented to accept a `dict`, `Table`, `TableReference`, or `TableListItem`, but the implementation only worked with a plain `dict`: - `Table` instance: `Table.from_api_repr()` was called backwards (it expects an API-JSON dict, not a `Table` object) → `TypeError: argument of type 'Table' is not iterable` - `TableReference` / `TableListItem`: raw `**`-unpacking on a non-mapping → `TypeError: 'TableReference' object is not a mapping` This is reachable from `BigQueryCreateTableOperator`, which has the identical type hint and forwards `table_resource` straight into the hook. A DAG author who follows the documented type hint and passes a `Table` obtained from `get_table()` / `list_tables()` hits a crash. ### Solution Convert any object input to a plain dict via `.to_api_repr()` before merging `schema_fields` and building the final `Table`. A bare `TableReference` is wrapped under `"tableReference"` since its `to_api_repr()` is flat, unlike `Table` / `TableListItem`. ### Tests Added unit tests in `TestTableOperations` covering all four input forms (`dict`, `Table`, `TableReference`, `TableListItem`) plus schema merging: - `test_create_table_with_table_object` - `test_create_table_with_table_reference_object` - `test_create_table_with_table_list_item` - `test_create_table_with_table_object_and_schema_fields` Ran locally: conversion logic verified against real `google.cloud.bigquery` objects; `ruff check` and `py_compile` clean. Full provider test suite runs in CI via breeze. -- 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]
