Error writing data to Google Bigquery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2022 12:25 PM
Hi,
I am able to read data from a Bigquery table ,But am getting error writing data to a table in Bigquery
Followed instuctions in this document.
Connecting Databricks to BigQuery | Google Cloud
%scala
import scala.io.Source
val contentCred = "/dbfs/FileStore/keys/uday_123.json"
val jsonBytes = Source.fromFile(contentCred).getLines.mkString
myEvents.write.format("bigquery").mode("overwrite").option("temporaryGcsBucket", "databricks-bq-789")
.option("credentials", new String(java.util.Base64.getEncoder.encode(jsonBytes.getBytes)))
.option("parentProject", "uday-***")
.option("project", "uday-***")
.option("table","uday-***.uday_testdata.employee1")
.save()
Error:
IOException: Error getting access token from metadata server at: http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token
Caused by: HttpResponseException: 404 Not Found
GET http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token
ResourceNotFound
The specified resource does not exist.
'computeMetadata' isn't a valid resource name.
- Labels:
-
Bigquery
-
Google
-
Google Bigquery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2022 11:13 PM
Thanks @Kaniz Fatma for the reply.
I have followed the steps mentioned in the thread, But I got the same error
OException: Error getting access token from metadata server at: http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token
Caused by: HttpResponseException: 404 Not Found
Please note I am able to read data from Bigquery table, But not able to write data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 11:12 PM
Could anyone reply on solution for this error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 08:40 AM
Hi @uday s,
I've encountered this issue earlier this week. Could you please ensure that your cluster configuration is correct? I was able to write to the BigQuery tables after following Step 2.
https://docs.databricks.com/data/data-sources/google/bigquery.html#step-2-set-up-databricks
Let me know if it works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 10:38 AM
I've the same issue. I can read a BigQuery table.
But when I'm trying to save data into bigquery :
IOException: Error getting access token from metadata server at: http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token
Caused by: HttpResponseException: 404 Not Found
GET http://***.***.***.***/computeMetadata/v1/instance/service-accounts/default/token
http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema">
ResourceNotFound
The specified resource does not exist.
'computeMetadata' isn't a valid resource name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2022 11:05 PM
Hi @uday s
Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.
We'd love to hear from you.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 09:27 AM
@udays22222 did you find any solution on this one? I face the same problem when I use Shared (Access mode) cluster. I can read but I cannot write with the error you mentioned.

