Create IAM policy
Stay organized with collections
Save and categorize content based on your preferences.
Create an IAM policy for a table.
Code sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis page provides code samples in Java and Python for creating an IAM policy for a BigQuery table.\u003c/p\u003e\n"],["\u003cp\u003eThe Java code sample initializes a BigQuery client, retrieves the existing IAM policy for a specified table, and adds a user with the "roles/bigquery.dataViewer" role.\u003c/p\u003e\n"],["\u003cp\u003eThe Python code sample demonstrates retrieving the IAM policy for a table, defining a binding with a specified role and member, appending the binding to the policy, and then setting and printing the updated policy.\u003c/p\u003e\n"],["\u003cp\u003eBoth Java and Python samples require setting up Application Default Credentials for authentication, as detailed in the linked documentation.\u003c/p\u003e\n"],["\u003cp\u003eThe code provided will allow users to control access to resources within BigQuery, as further explained in a linked article.\u003c/p\u003e\n"]]],[],null,[]]