Manage context sets in Cloud SQL for MySQL Studio

This document describes how to create context sets in Cloud SQL for MySQL Studio using a context set file. Context set names must be unique within a database.

To learn about context sets, see Context sets overview.

Before you begin

Complete the following prerequisites before creating an agent.

Enable required services

Enable the following services for your project:

Prepare a Cloud SQL instance

Required roles and permissions

Grant executesql permission to Cloud SQL instance

To grant the executesql permission to Cloud SQL instance and enable the Cloud SQL Data API, run the following command:
gcloud config set project PROJECT_ID
gcloud components update
gcloud beta sql instances patch INSTANCE_ID --data-api-access=ALLOW_DATA_API
Replace the following:
  • PROJECT_ID: The ID of your Cloud de Confiance by S3NS project.
  • INSTANCE_ID: The ID of your Cloud SQL instance.
To perform steps in this tutorial, sign in to Cloud de Confiance by S3NS, and then authenticate to the database using IAM authentication.

Create a context set

To create a context set, perform the following steps:

  1. In the Cloud de Confiance by S3NS console, go to the Cloud SQL page.

    Go to Cloud SQL

  2. Select an instance from the list.

  3. In the navigation menu, click Cloud SQL Studio.

  4. Sign in to Studio using IAM authentication.

  5. In the Explorer pane, next to Context sets, click View actions.

  6. Click Create context set.

  7. In Context set name, provide a unique context set name. The context set name is case-sensitive and can contain letters, numbers, hyphens, and underscores.

  8. Optional. In Context set description, add a description for your context set.

  9. Click Create.

Build context sets

After creating a context set, follow the steps in Build contexts using Gemini CLI to create a context set file. You can then edit your context set to upload the context set file.

Edit a context set

To edit a context set, perform the following steps:

  1. In the Cloud de Confiance console, go to the Cloud SQL page.

    Go to Cloud SQL

  2. Select an instance from the list.

  3. In the navigation menu, click Cloud SQL Studio.

  4. Sign in to Studio using Identity and Access Management authentication.

  5. In the Explorer pane, next to Context sets, click View actions.

  6. Click Edit context set.

  7. Optional: Edit Context set description.

  8. Click Browse in the Upload context set file section, and select the context set file.

  9. Click Save.

Delete a context set

To delete a context set, perform the following steps:

  1. In the Cloud de Confiance console, go to the Cloud SQL page.

    Go to Cloud SQL

  2. Select an instance from the list.

  3. In the navigation menu, click Cloud SQL Studio.

  4. Sign in to Studio using Identity and Access Management authentication.

  5. In the Explorer pane, next to Context sets, click View actions.

  6. Click Delete context set.

  7. In the Delete context set confirmation dialog, enter the name of the context set.

  8. Click Confirm to delete the context set.

What's next