Import data from BigQuery to Cloud Storage in different project

1.3k Views Asked by At

I have two projects under the same account:

  • projectA with BQ and projectB with cloud storage
  • projectA has BQ with dataset and table - testDataset.testTable
  • prjectB has cloud storage and bucket - testBucket
  • I use python, google cloud rest api
  • account key credentials for every project, with different permissions: projectA key has permissions only for BQ; projectB has permissions only for cloud storage

What I need:

import data from projectA testDataset.testTable to projectB testBucket

Problems

  • of course, I'm running into error Permission denied while I'm trying to do it, because apparently, projectA key does not have permissions for projectB storage and etc
  • another strange issue as I have testBucket in projetB I can't create a bucket with the same name in projectA and getting

This bucket name is already in use. Bucket names must be globally unique. Try another name.

So, looks like all accounts are connected I guess it means should be possible to import data from one account to another one via API

What can I do in this case?

1

There are 1 best solutions below

0
On

You put this wrong. You need to provide access to the user account on both projects to have accessible across projects. So there needs to be a user authorized to do the BQ thing and also the GCP thing on the different project.

Also Bucket names must be globally unique it means I can't create the name as well, it's global (for the entire planet you reserved that name, not just for project)