Specify schema for Gemini Notebook logs in BigQuery

When you load data into a table or create an empty table in BigQuery, you must specify a schema. This page describes the table schema and example queries for common reports you can get from BigQuery.

About the activity table

You can review Gemini Notebook log events in the activity table. You can find:

  • The notebook container in standard Google Workspace primary resource fields, such as resource_ids and resource_details. Use these fields to track the notebook ID, title, type, owner, and web URL.
  • Event-specific parameters, such as source material and Studio artifact details, nested in the gemini_notebook record.

About the primary resource fields

The following table defines the primary resource fields in the activity table that identify and describe the notebook.

Field name Type Mode Description
resource_ids STRING REPEATED Array containing the unique identifier (UUID) of the notebook
resource_details RECORD REPEATED Details about the notebook associated with the log event
resource_details.id STRING NULLABLE UUID for the notebook. Corresponds to the notebook ID in the web URL: https://notebook.google.com/notebook/id
resource_details.title STRING NULLABLE Display name or title of the notebook
resource_details.type STRING NULLABLE Resource type category for the notebook (GEMINI_NOTEBOOK_NOTEBOOK)
resource_details.owner_details.owner_identity.user_identity.user_email STRING NULLABLE Email address of the notebook owner

Template table for Gemini Notebook

The following template table defines and describes the event-specific fields nested within the gemini_notebook record in the activity table. Schema components on this page are updated occasionally. When new fields are added, the next daily table generated from the template has the new fields. If you want to query new fields, query daily tables generated after the template is updated.

Learn how to specify and modify schemas in BigQuery.

Field name Type Mode Description
ai_plan_tier ENUM NULLABLE The user's generative AI subscription tier at the time the event took place. Possible values:
  • AI Expanded
  • Plus
  • Pro
  • Standard
  • Ultra
prior_visibility ENUM NULLABLE Notebook visibility prior to the event. Possible values:
  • anyone_with_link
  • private
  • public
  • shared_internally
recipient STRING NULLABLE User or group whose access was modified in the event.
recipient_access_type ENUM NULLABLE Type of access granted to or removed from the recipient. Possible values:
  • view
  • edit
  • remove
source_id STRING NULLABLE Unique identifier for the source material that's referenced in the notebook.
source_name STRING NULLABLE Display name of the source material that's referenced in the notebook.
source_type ENUM NULLABLE Data type of the source. Possible values:
  • copied_text
  • drive
  • local_upload
  • url
source_url STRING NULLABLE URL of the source.
studio_artifact_id STRING NULLABLE Unique identifier for the generated Studio artifact.
studio_artifact_name STRING NULLABLE Display name of the Studio artifact.
studio_artifact_type ENUM NULLABLE Data type of the Studio artifact. Possible values:
  • audio_overview
  • data_table
  • flashcards
  • infographic
  • mind_map
  • quiz
  • report
  • slide_deck
  • video_overview
visibility ENUM NULLABLE Notebook visibility following the event. Possible values:
  • anyone_with_link
  • private
  • public
  • shared_externally
  • shared_externally_trusted_domain
  • shared_internally

This example uses standard SQL. Replace project-id.dataset-id with your project ID and dataset name. The query returns the unique identifier, title, resource type, owner email address, total number of sources added and Studio artifacts generated, and direct URL for each notebook.

-- List notebooks with owner, activity counts, and direct web URLs
SELECT
  resource_details[SAFE_OFFSET(0)].id AS notebook_id,
  ANY_VALUE(resource_details[SAFE_OFFSET(0)].title) AS notebook_title,
  ANY_VALUE(resource_details[SAFE_OFFSET(0)].type) AS resource_type,
  ANY_VALUE(resource_details[SAFE_OFFSET(0)].owner_details.owner_identity[SAFE_OFFSET(0)].user_identity.user_email) AS owner_email,
  COUNTIF(event_name = 'add_source') AS total_sources,
  COUNTIF(event_name = 'generate_studio_artifact') AS total_artifacts,
  ANY_VALUE(CONCAT('https://notebook.google.com/notebook/', resource_details[SAFE_OFFSET(0)].id)) AS notebook_url
FROM `project-id.dataset-id.activity`
WHERE gemini_notebook IS NOT NULL
GROUP BY notebook_id;