Use Colab Data Apps in BigQuery and Data Studio

Colab Data Apps let you transform your data analyses from Colab notebooks into polished, interactive applications. Instead of sharing code or static reports, you can now build shareable experiences that include interactive visualizations, data tables, and machine learning inferences.

Colab Data Apps provide the following:

  • Self-service insights: Business users can adjust parameters such as date ranges or filters to see the data that they need without editing code.
  • No setup for app viewers: Consumers access your app using a URL. They don't need to navigate the Google Cloud console or run notebooks.
  • Flexibility: Integrate any Python visualization library or widget to build custom, complex Data Apps with ease. To save time, use the integrated agent to generate the code for you.
  • Managed Lifecycle: Administrators and authors retain control over sharing, versions, and resource usage.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

  6. Enable the BigQuery, Dataform APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

    For new projects, the BigQuery API is automatically enabled.

Required roles

To get the permissions that you need to create data apps, ask your administrator to grant you the following IAM roles on project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

If you're new to Colab Enterprise in BigQuery, see the required permissions on the Create notebooks page.

Limitations

Colab Data Apps are subject to the following limitations:

  • The first time you open an app, it can take from two to five minutes to load, depending on its complexity.

  • Interactivity sessions last for 30 minutes. After 30 minutes, apps lose their connection to the kernel and become static. To initiate a new 30 minute session, you can reload the page or refresh the data.

  • Regardless of which cells are visible in the app, all cells are run in order from first to last. If non-visible cells are running and consuming kernel resources, the app might appear unresponsive until kernel resources are freed.

  • You can't use a service account or End User Credentials (EUC) for data access or for viewing Data Apps.

Components of Data Apps

The components you can add to your Data Apps are derived from the underlying notebook. If you're working with an existing notebook, any of the existing cells can be added to your Data Apps.

Any supported cell types that you can create in a Colab notebook can be added to Data Apps, including SQL cells, code cells, text cells, and visualization cells. You can create cell types manually, or you can use the Colab Data Science Agent or Gemini to generate cells for you.

For information on adding different cell types to notebooks, see the following tutorials:

Create controls using third-party libraries

Data Apps support controls that are created using third-party widget libraries. For example:

  • You can use iPywidgets or AnyWidget to add interactive controls to your notebook. The widgets can be generated by using the Colab Data Science Agent.
  • At the notebook level, you can chain widget cells. You define a widget at the start of the notebook, and its output can be consumed by other cells such as visualization cells. This lets you set up a global filter for your Data Apps.

Create and publish Data Apps

You can create Colab Data Apps using an existing notebook or by creating a new one. In the following example, you use the Getting started with notebooks for Python users template to generate a notebook and to create a Data App from it.

After you create Data Apps, you publish them to Data Studio to turn your data analyses into shareable, interactive experiences.

When you publish Data Apps, you can connect them to an existing Colab runtime, or you can create a new runtime using a template. With templates, you can size the runtime according to your workloads, and you can set idle shutdown time to balance costs and app startup time.

To create and publish Data Apps, follow these steps:

  1. Go to the Studio page.

    Go to Studio

  2. Click the arrow drop-down and then choose Notebook > All templates.

  3. Alternatively, from from the BigQuery Studio home page, click View notebook gallery.

    The View notebook gallery link on the BigQuery Studio home page.

  4. Click the Getting started with notebooks for Python users card or search for it in the gallery.

  5. After the template opens, click Use this template to convert the template into a runnable notebook.

  6. Click dashboard Data app.

  7. In the Components pane, you can add and remove cells from the app by using the checkboxes.

    The components pane where you can add and remove cells from the app.

  8. To create new components, click keyboard_backspace Notebook to go back to the notebook, and then add new cells.

  9. When you're satisfied with the layout of your app, click Publish.

  10. On the Publish page, enter the following:

    1. In the Name field, enter a name for the app. The app name doesn't have to be the same as the name of the notebook used to create it.

    2. In the Runtime field, choose Connect to an existing runtime and choose the runtime, or choose Create new runtime and choose the appropriate template.

      If you choose Connect to an existing runtime, your notebook must be connected to a runtime before you publish the app.

      The Publish page for your app

    3. Click Publish.

    4. If you're prompted to give Data Studio access your Google Account, click Allow.

  11. If you make changes to your source notebooks and your app, you can update the app by clicking Publish changes.

  12. Alternatively, from Data Studio you can edit the app by clicking more_vert More options > Edit.

    This opens the source notebook in BigQuery Studio.

View and share Data Apps

You use Data Studio to view your Colab Data Apps and to share your apps with others.

When you view an app, interactivity is based on the components you included. For example, a Matplotlib chart is static, and a chart created using Colab visualization cells or using libraries such as Plotly is interactive.

You can interact with widgets defined in your code, and use them for tasks like filtering or changing the output. These interactions are user-specific.

To view and share your app in Data Studio, follow these steps:

  1. To view your app in Data Studio, click View Data App.

  2. To share your app, in Data Studio, click person_add Share.

  3. On the Share with people and groups page, do the following:

    1. In the Add people and groups field, enter the groups and individuals you're granting access.

    2. Select the access permission for the users and groups you specified:

      • Editor: Users can edit the app, create and edit schedules and alerts, and share the app with others.
      • Viewer: Users can see the app but can't edit or share it with others.
    3. Click Send.

  4. To invite others, get a report link, or share or download the app, beside the Share option, click arrow_drop_down, and then choose one of the following:

    • Invite people
    • Get report link
    • Download report

    The share menu in Data Studio

For more information on sharing assets in Data Studio, see Invite others to your reports.

Reconnecting and refreshing Data Apps

Interactivity sessions last for 30 minutes. After 30 minutes, apps lose their connection to the kernel and become static. To initiate a new 30 minute session, you can reload the page or refresh the data.

To refresh the data:

  1. Open your app in Data Studio. With your app open, click View Data App.

  2. In Data Studio, click more_vert More report actions > Refresh data.

Credentials used to run cells in Data Apps

By default, Data Apps use the app creator's credentials for data access and to render visualizations. All viewers see the rendered Data Apps based on the author's access. Consider this before you share Data Apps that have access to sensitive data.

Delete Data Apps

You can delete Data Apps using Data Studio. Deleting the notebook that was used to create the app doesn't delete the app or prevent the app from functioning.

To delete Data Apps in Data Studio, follow these steps:

  1. Sign in to Data Studio.

  2. On the Recent page, locate your app.

  3. At the end of the row, click more_vert More options > Remove.

    The More options menu that you use to delete an app

Pricing

You are charged for running code in the notebook's runtime and for any BigQuery slots you used. For more information, see Colab Enterprise pricing.