Let's say I have the following table:
CREATE OR REPLACE TABLE tmp.table_description_test AS (
SELECT
1 AS a,
STRUCT(2 AS c, 3 AS d) AS b
)
Adding a description for a
or b
is easy:
ALTER TABLE tmp.table_description_test ALTER COLUMN a
SET OPTIONS (description = 'description of a');
ALTER TABLE tmp.table_description_test ALTER COLUMN b
SET OPTIONS (description = 'description of b');
But how can I add/change a description for the nested fields?
ALTER TABLE tmp.table_description_test ALTER COLUMN b.c
SET OPTIONS (description = 'description of b.c');
Does not work:
Syntax error: Unexpected "." at [1:54]
Based on my understanding, we cannot use a BigQuery alter DDL statement to modify nested columns. As a simple workaround you can consider using BigQuery UI to add description to the column.
Example:
If you want this feature to be implemented, you can open a new feature request on the issue tracker. You can also take a look at the stack thread also.