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.
- Navigate to BigQuery. Once there, click the dropdown arrow and select “Compose new Python notebook”.
- If prompted, select a default region to store your notebooks. We recommend “us-central1 (Iowa)”.
- Once a new notebook is created, you can click on the default name of the notebook (usually “Untitled notebook X”) to rename it.
- 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!
- 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”.
- A panel will open, allowing you to select a runtime to connect to.
- If you have no runtimes created for your project yet, then you’ll need to create a new runtime.
- NOTE: Only Administrators can create new runtimes.
- Create a default runtime in your region.
- 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.
- Select your CTA account in order to continue.
- Make sure that all permission boxes are clicked here, and then click “Continue”.
- 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.
- 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.
- You’ll be able to see the Job ID, the execution status, and the download status.
- You’ll be able to see the Job ID, the execution status, and the download status.
- After execution is finished, you can view the results by clicking the code block below and then pressing the “Play” icon there.
- You can add a new code or text block by hovering above/below an existing block or in the upper left corner.
- You can also move or delete existing blocks by selecting it and using the menu in the upper right corner of the block.
- Note: if you move a block up/down, you’ll impact the flow of your notebook and code execution and results will change accordingly.
- Note: if you move a block up/down, you’ll impact the flow of your notebook and code execution and results will change accordingly.
- 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
Feedback sent
We appreciate your effort and will try to fix the article