1

While I trying to reach the external table's data, I'm getting error like as below. I can not solve this issue. Here are the details about the situation;

google.api_core.exceptions.NotFound: 404 Not found: Files /gdrive/id/id123456id

PS: id123456id is a dummy id.

The file with ID id123456 id exists in my Google Drive. Bigquery table looking this id.

bq_test.json -> service account credential's JSON file. This service account has those roles;

  • BigQuery Data Editor
  • BigQuery Data Owner
  • BigQuery Data Viewer
  • BigQuery User
  • Owner

Here is my code block:

from google.cloud import bigquery
from google.oauth2.service_account import Credentials

scopes = (
        'https://www.googleapis.com/auth/bigquery',
        'https://www.googleapis.com/auth/cloud-platform',
        'https://www.googleapis.com/auth/drive'
)
credentials = Credentials.from_service_account_file('bq_test.json')
credentials = credentials.with_scopes(scopes)
client = bigquery.Client(credentials=credentials)

QUERY = (
        """SELECT * FROM
            `project_name.dataset_name.ext_table`
            LIMIT 5"""
        )
query_job = client.query(QUERY)
rows = query_job.result()

for row in rows:
    print(row.name)
2
  • Sounds like the service account doesnt have access. Commented Sep 10, 2020 at 11:07
  • @DaImTo How can I give access? I cannot find drive.readonly or something else in the role list. Commented Sep 10, 2020 at 11:12

1 Answer 1

1

I solved the problem as follows;

This flow provides the solution in my case.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.