Skip to main content

GCP: google.api_core.exceptions.BadRequest: 400 POST , when running a bigquery in your shell


I like to code directly in the GCP console editor to test some POCs, but with this approach you have to deal with some situations, such as, getting your shell and editor disconnected after a few minutes idle, then when you retake your coding and re running your python code to execute some bigquery statements, you can see a nasty error like this:

google.api_core.exceptions.BadRequest: 400 POST https://bigquery.googleapis.com/bigquery/v2/projects//jobs: Invalid project ID ''. Project IDs must contain 6-63 lowercase letters, digits, or dashes. Some project IDs also include domain name separated by a colon. IDs must start with a letter and may not end with a dash.

what happened?, you gcp shell was reseted and you lost your project connection, you can check that:

(venv) jcalfucura@cloudshell:~/crossprod$ gcloud config list --format 'value(core.project)' 2>/dev/null

returns nothing.
You can also use this statement:

(venv) jcalfucura@cloudshell:~/crossprod$ gcloud config get-value projectYour active configuration is: [cloudshell-12345]WARNING: The project property is set to the empty string, which is invalid.To set your project, run: $ gcloud config set project PROJECT_IDor to unset it, run: $ gcloud config unset project

So, the correct way is to bind your code with the project.

Comments

Popular posts from this blog

Fabiano Caruana kicking ass like a madman at Sinquefield Cup, perfect score so far.

Well, it seems that there is a monster in town, and no, my friend, he is not a talented norwegian boy, he comes from the land of pizza and macaroni. Fabiano Caruana has defeated every single top player in the Sinquefield cup, including no other than current world champion and number 1 Magnus Carlsen. To put Caruana's performance in context we must remember some other great winning streaks such as Fischer's interzonal-candidates (including 6-0 over Taimanov and 6-0 over Larsen), Karpov at Linares 1994, Topalov at San Luis 2006. So, we must wait for the second leg of this tournament, Caruana can still enhance his score, there is a nice article at chess.com These recent results from Caruana just confirm that he is the closer contender for Magnus Carlsen, the world champion has been affected by a decline in his game since the olympiad in Norway, there must be some psychological component on it, since he is not even close to his impressive results from the last 3 years. Now, fo

Smart Mobile Studio, the rise of compiled JS programming languages and why the future is happening right now.

Javascript is the present and future of pretty much every web based technology either desktop or backend, no doubt about it, just look at the impressive momentum of tools suchs as Angular and Node.js, look at the efforts of giant companies strongly trying to deliver the next holy grail of  JS compiled programming languages, to my mind comes Microsoft with Typescript and Google with Dart. They both try to fill the gap between an obscure and alien language like JS and the elegance and productivity of object oriented, garbage collected languages. If you (like me) miss some nice IDE with superproductive features that enable to build production quality JS desktop and server apps i recommend you to look no further at software giants like already mentioned Google and Microsoft the answer to your problems could be in a small, Norway based software shop. Smart Mobile Studio is the creation of a small team of programming gurus very well known inside the Delphi Community, did i say "Delp