title: How to fix 'User does not have permission to query table XYZ.' in BigQuery?
body: <p>I want to do a BQ query via the <code>bq</code> command.</p>
  
  <p>Here is my command:</p>
  
  <pre><code>bq query    --application_default_credential_file $GOOGLE_APPLICATION_CREDENTIALS  
    --nouse_legacy_sql 'SELECT * FROM `my_project.data.Document` limit 100' 
  </code></pre>
  
  <p><code>GOOGLE_APPLICATION_CREDENTIALS</code> points to a credential file. I can use this variable to enable <code>gcloud</code> command to access my project's resources.</p>
  
  <p>The query runs OK if I run it directly in bigquery query UI. I log in as myself. </p>
  
  <p>However <code>bq</code>  failed with this error <code>Access Denied: Table my_project:data.Document: User does not have permission to query table
  my_project:data.Document.</code> </p>
  
  <p>I have granted these roles to the id, a service account, contained in the credential file:</p>
  
  <p><a href="https://i.stack.imgur.com/fJGzp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fJGzp.png" alt="enter image description here"></a></p>
  
  <p>Did I miss any role/permission?</p>