Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A sample query to test:

%%bigquery testdf
SELECT distinct Product_Name FROM `projectname.datasetname.tablename`
order by Product_Name

That will put the result of the query in a pandas dataframe called testdf. To verify:
print(testdf)

A few notes:
- When you’re done using Jupyter, please go back into the console and stop your instance.
- The instances time out after 60 minutes of no use, so it’s not the end of the world
if you don’t stop it, but it’s a good practice to get into.
- The instances are not huge – 2 CPU, 7.5 GB of RAM, no GPU, 100 GB of disk. If you need more power, please let me know.

Update: March 9, 2022

Aaron Gussman from Google sent along an example of using the notebooks API to create a managed notebook instance, which doesn't appear to be in Google's documentation anywhere yet.

Here is the API example to create a Managed Notebooks runtime with Idle Shutdown settings:

BASE_ADDRESS="notebooks.googleapis.com"

LOCATION="us-central1"

PROJECT_ID="YOUR_PROJECT_ID"

AUTH_TOKEN=$(gcloud auth application-default print-access-token)

RUNTIME_ID="my-runtime"

OWNER_EMAIL="YOUR_EMAIL"

RUNTIME_BODY="{

  'access_config': {

    'access_type': 'SINGLE_USER',

    'runtime_owner': '${OWNER_EMAIL}'

  },

  'software_config': {

    'idle_shutdown': true,

    'idle_shutdown_timeout': 180

  }

}"


curl -X POST https://${BASE_ADDRESS}/v1/projects/$PROJECT_ID/locations/$LOCATION/runtimes?runtime_id=${RUNTIME_ID} -d "${RUNTIME_BODY}" \

 -H "Content-Type: application/json" \

 -H "Authorization: Bearer $AUTH_TOKEN" -v