bunny
bunny

Reputation: 354

How to add description as part of schema metadata in BigQuery Views

I am looking a way how we can add description of fields to the views. In BQ UI there is no way to add description, its only for tables.

Is there way to do it programmatically using api's.

Upvotes: 1

Views: 1656

Answers (3)

Igor Tiulkanov
Igor Tiulkanov

Reputation: 596

Now it is possible to do by using custom synthax in SQL:

CREATE VIEW `myproject.mydataset.newview` (
  column_1_new_name OPTIONS (DESCRIPTION='Description of the column 1 contents'),
  column_2_new_name OPTIONS (DESCRIPTION='Description of the column 2 contents'),
  column_3_new_name OPTIONS (DESCRIPTION='Description of the column 3 contents')
)
AS SELECT column_1, column_2, column_3 FROM `myproject.mydataset.mytable`

Reference: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#specifying_view_options

Upvotes: 0

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172944

indirect way to provide description for fields in view is to provide good comments in View's Query. So then, when you go to View's Details Panel (vs Schema) you will see those comments/description in Query Box (below) View Info section.
Another option so far is to reuse View's Description - this one is available in both UI and API.
Rather than that there is no support that I know of to individual filed's description for view

Upvotes: 1

Danny Kitt
Danny Kitt

Reputation: 3251

It is not possible for views to have field descriptions at present. There's an open feature request on our public issue tracker to implement this. You can star the issue to let us know it's something you're interested in and we'll prioritize accordingly.

Upvotes: 1

Related Questions