Python Notebooks in BigQuery Studio

Created by Ben Deverman, Modified on Wed, 29 May at 3:50 PM by Shoham Geva

Did you know you can write and execute code in Python notebooks right in your BigQuery Studio dashboard? Here are the steps to create a new notebook and run code in it!

Please Note: Must be an administrator or editor user. If this is the first time notebooks are being run in your project, you will need to send in a help@ ticket for CTA to enable notebooks before moving forward. 

  1. Navigate to BigQuery. Once there, click the dropdown arrow and select “Compose new Python notebook”.

  2. If prompted, select a default region to store your notebooks. We recommend “us-central1 (Iowa)”.

  3. Once a new notebook is created, you can click on the default name of the notebook (usually “Untitled notebook X”) to rename it.

  4. Once your notebook is created, you’ll be able to see it in the left-side Explorer panel in the “Notebooks” section so you can reopen it whenever you need to!

  5. In order to execute code, you’ll need to connect to a runtime environment. In the notebook panel, click the dropdown arrow in the upper right next to “Connect” and select “Connect to a runtime”.

  6. A panel will open, allowing you to select a runtime to connect to.

  7. If you have no runtimes created for your project yet, then you’ll need to create a new runtime.
    1. NOTE: Only Administrators can create new runtimes.

 

  1. Create a default runtime in your region.

  2. After creating, the runtime will take a few minutes to fully provision. You may be prompted to open an OAuth popup to allow Colab Enterprise to access Google Cloud Services. If so, open the popup and follow the instructions to authorize.

  3. Select your CTA account in order to continue.

  4. Make sure that all permission boxes are clicked here, and then click “Continue”.

  5. Once you’ve authorized Colab Enterprise, runtime creation will continue. You’ll be able to tell when it finishes by the green check-mark and RAM/Disk in the upper right or the “Connected to ” near the bottom center.

  6. After connecting to a runtime, you can now execute code! By default, there’s example code blocks that you can run. Click the “Play” icon to the left of the selected code block that you want to execute.
    1. You’ll be able to see the Job ID, the execution status, and the download status.

  7. After execution is finished, you can view the results by clicking the code block below and then pressing the “Play” icon there.

  8. You can add a new code or text block by hovering above/below an existing block or in the upper left corner.

  9. You can also move or delete existing blocks by selecting it and using the menu in the upper right corner of the block.
    1. Note: if you move a block up/down, you’ll impact the flow of your notebook and code execution and results will change accordingly.

  10. Happy coding!

Have questions? Contact us at help@techallies.org.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article