1
votes

I need to export query result to my own local machine to use these data in a program.

I created a bucket and I copied the bucket URL taht starts with gs as shown here: enter image description here

I added a public projetc dataset to my own BigQuery project. I made a query and got the results. I click on Export Table that appears above the query results. Then I paste my bucket URL as follows: enter image description here I get this error:

Invalid extract destination URI 'gs://xxxx_test_bucket'. Must be a valid Google Cloud Storage path and filename/pattern. Dismiss

I tried by pasting the URL after I remove gs in my URL. I get this same error:

Invalid extract destination URI 'gs://xxxx_test_bucket'. Must be a valid Google Cloud Storage path and filename/pattern. Dismiss

When I created the bucket, I edited the bucket's permissions (from the three dots at the far right in the bucket, I added my google account that I use for BigQuery as a storage legacy bucket owner.

Please, how can I export my query results to a CSV into my local machine? I created a bucket as a temporal storage as it seems the only way to export results to. Can I download my bucket storage CSV results into my local machine?

2

2 Answers

3
votes

You need to give the extract a file name too:

gs://xxxxx_test_bucket/filename.csv

You're missing - in this example - "filename.csv"

0
votes

Below is relatively generic answer:

Whenever you are in BigQuery Web UI and something not clear for you - look for help icon (question sign inside circle) - hover over and click it - and in many cases you will get the asnwer right away. For example in your case - such help icon is to the right of entry box for Storage URI. if you click on it - you will see quite descriptive help and sometimes even link to documentation.

For example - for your question you would see below help

Google Cloud Storage URIs begin with "gs://" and specify the bucket and object you wish to import.

Example: gs://mybucket/path/to/mydata.csv

Maximum table export size is 1GB. For exports greater than 1GB, specify file pattern with a *

Example: gs://mybucket/path/to/mylargedata*

Hope this will help you next time in similar situations!