Search code examples
google-bigqueryview

How to list Currently Authorized Views in BigQuery?


I want to list all the Currently Authorized Views in a dataset (projectID, datasetID, and tableID).

I have try to check using Information schema but still face the dead end. I want to gather information about projectID, datasetID, and tableID. Is there any possible way to do it?

Image of Authorized View

1


Solution

  • Inorder to list views in BigQuery, you can use below queries.

    To Return metadata for views in a single dataset

    SELECT * FROM dataset.INFORMATION_SCHEMA.VIEWS
    

    To Return metadata for all views in a region

    SELECT * FROM region-us.INFORMATION_SCHEMA.VIEWS
    

    It's not possible to query only the authorized views using INFORMATION_SCHEMA. As per your requirement to view projectID, datasetID, and tableID details of Authorized Views in a dataset, as you have mentioned you can go to your dataset and click + Sharing > Authorize Views where you can add authorization and view the Currently Authorized Views.

    enter image description here

    For more information you can refer to this tutorial.

    If you want the feature to view details of authorized views using INFORMATION_SCHEMA as present in BigQuery UI, you can raise a feature request on the issue tracker describing your requirement.