A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/sql/docs/mysql/integrate-cloud-sql-with-vertex-ai below:

Integrate Cloud SQL with Vertex AI | Cloud SQL for MySQL

This page describes how to integrate Cloud SQL with Vertex AI. This integration lets you apply large language models (LLMs), which are hosted in Vertex AI, to a Cloud SQL for MySQL database, version 8.0.36 and later.

By integrating Cloud SQL with Vertex AI, you can apply the semantic and predictive power of machine learning (ML) models to your data. This integration extends the SQL syntax with two functions for querying models:

As a result, you can make real-time predictions and gain valuable insights directly within the database, streamlining your workflows and enhancing your decision-making capabilities.

  • Create or update a Cloud SQL instance so that the instance can integrate with Vertex AI. gcloud Create the instance

    To create the Cloud SQL instance, use the gcloud sql instances create command.

    gcloud sql instances create INSTANCE_NAME \
    --database-version=DATABASE_VERSION \
    --tier=MACHINE_TYPE \
    --region=REGION_NAME \
    --edition=EDITION_NAME \
    --enable-google-ml-integration

    Make the following replacements:

    Note: For more information about these parameters, see Create instances. Update the instance

    To update the instance, use the gcloud sql instances patch command.

    gcloud sql instances patch INSTANCE_NAME \
    --enable-google-ml-integration \

    If this update modifies a value that requires a restart, then you see a prompt to proceed with the change or cancel.

    Note: For more information about updating an instance, see Edit instances. REST v1 Create the instance

    Use this example to create the instance. For a complete list of parameters for this call, see the instances:insert page. For information about instance settings, including valid values for a region, see Instance settings.

    Before using any of the request data, make the following replacements:

    Note: For more information about these parameters, see Create instances.

    You must also include the enableGoogleMlIntegration object in the request. Set the following parameters, as required:

    HTTP method and URL:

    POST https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances

    Request JSON body:

    {
      "name": "INSTANCE_NAME",
      "region": "REGION_NAME",
      "databaseVersion": "DATABASE_VERSION",
      "rootPassword": "PASSWORD",
      "settings": {
        "tier": "MACHINE_TYPE",
        "edition": "EDITION_TYPE",
        "enableGoogleMlIntegration": "true" | "false"
        "databaseFlags":
          {
            "name": "cloudsql.enable_google_ml_integration",
            "value": "on" | "off"
          }
      }
    }
    

    To send your request, expand one of these options:

    curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login , or by using Cloud Shell, which automatically logs you into the gcloud CLI . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances"
    PowerShell (Windows) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `


    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances" | Select-Object -Expand Content

    You should receive a JSON response similar to the following:

    {
      "kind": "sql#operation",
      "targetLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_ID",
      "status": "PENDING",
      "user": "user@example.com",
      "insertTime": "2019-09-25T22:19:33.735Z",
      "operationType": "CREATE",
      "name": "OPERATION_ID",
      "targetId": "INSTANCE_ID",
      "selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/operations/OPERATION_ID",
      "targetProject": "PROJECT_ID"
    }
    
    Update the instance

    Use this example to update the instance. For a complete list of parameters for this call, see the instances.patch page.

    If this update modifies a value that requires a restart, then you see a prompt to proceed with the change or cancel.

    Before using any of the request data, make the following replacements:

    HTTP method and URL:

    PATCH https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME

    Request JSON body:

    {
      "settings": {
        "enableGoogleMlIntegration": true,
        "databaseFlags":
          {
            "name": "cloudsql.enable_google_ml_integration",
            "value": "on"
          }
       }
    }

    To send your request, expand one of these options:

    curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login , or by using Cloud Shell, which automatically logs you into the gcloud CLI . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    curl -X PATCH \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME"
    PowerShell (Windows) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `


    -Method PATCH `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME" | Select-Object -Expand Content

    You should receive a JSON response similar to the following:

    {
      "kind": "sql#operation",
      "targetLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME",
      "status": "PENDING",
      "user": "user@example.com",
      "insertTime": "2020-01-16T02:32:12.281Z",
      "operationType": "UPDATE",
      "name": "OPERATION_ID",
      "targetId": "INSTANCE_NAME",
      "selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/operations/OPERATION_ID",
      "targetProject": "PROJECT_ID"
    }
    
    Note: For more information about updating an instance, see Edit instances. REST v1beta4 Create the instance

    Use this example to create the instance. For a complete list of parameters for this call, see the instances:insert page. For information about instance settings, including valid values for a region, see Instance settings.

    Before using any of the request data, make the following replacements:

    Note: For more information about these parameters, see Create instances.

    You must also include the enableGoogleMlIntegration object in the request. Set the following parameters, as required:

    HTTP method and URL:

    POST https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances

    Request JSON body:

    {
      "name": "INSTANCE_NAME",
      "region": "REGION_NAME",
      "databaseVersion": "DATABASE_VERSION",
      "rootPassword": "PASSWORD",
      "settings": {
        "tier": "MACHINE_TYPE",
        "edition": "EDITION_TYPE",
        "enableGoogleMlIntegration": "true" | "false"
        "databaseFlags":
          {
            "name": "cloudsql.enable_google_ml_integration",
            "value": "on" | "off"
          }
      }
    }
    

    To send your request, expand one of these options:

    curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login , or by using Cloud Shell, which automatically logs you into the gcloud CLI . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances"
    PowerShell (Windows) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `


    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances" | Select-Object -Expand Content

    You should receive a JSON response similar to the following:

    {
      "kind": "sql#operation",
      "targetLink": "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances/INSTANCE_ID",
      "status": "PENDING",
      "user": "user@example.com",
      "insertTime": "2019-09-25T22:19:33.735Z",
      "operationType": "CREATE",
      "name": "OPERATION_ID",
      "targetId": "INSTANCE_ID",
      "selfLink": "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/operations/OPERATION_ID",
      "targetProject": "PROJECT_ID"
    }
    
    Update the instance

    Use this example to update the instance. For a complete list of parameters for this call, see the instances.patch page.

    If this update modifies a value that requires a restart, then you see a prompt to proceed with the change or cancel.

    Before using any of the request data, make the following replacements:

    HTTP method and URL:

    PATCH https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME

    Request JSON body:

    {
      "settings": {
        "enableGoogleMlIntegration": true,
        "databaseFlags":
          {
            "name": "cloudsql.enable_google_ml_integration",
            "value": "on"
          }
       }
    }

    To send your request, expand one of these options:

    curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login , or by using Cloud Shell, which automatically logs you into the gcloud CLI . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    curl -X PATCH \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME"
    PowerShell (Windows) Note: The following command assumes that you have logged in to the gcloud CLI with your user account by running gcloud init or gcloud auth login . You can check the currently active account by running gcloud auth list.

    Save the request body in a file named request.json, and execute the following command:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `


    -Method PATCH `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME" | Select-Object -Expand Content

    You should receive a JSON response similar to the following:

    {
      "kind": "sql#operation",
      "targetLink": "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME",
      "status": "PENDING",
      "user": "user@example.com",
      "insertTime": "2020-01-16T02:32:12.281Z",
      "operationType": "UPDATE",
      "name": "OPERATION_ID",
      "targetId": "INSTANCE_NAME",
      "selfLink": "https://sqladmin.googleapis.com/v1beta4/projects/PROJECT_ID/operations/OPERATION_ID",
      "targetProject": "PROJECT_ID"
    }
    
    Note: For more information about updating an instance, see Edit instances.
  • This section contains information about issues associated with integrating Cloud SQL with Vertex AI along with steps for troubleshooting the issues.

    Issue Troubleshooting Error message: Google ML integration API is supported only on MySQL version 8.0.36 or above. To enable the Vertex AI integration in Cloud SQL, you must have a Cloud SQL for MySQL database, version 8.0.36 or later. To upgrade your database to this version, see Upgrade the database minor version. Error message: Google ML Integration API is not supported on shared core instance. Please upsize your machine type. If you selected a shared core for the machine type of your instance, then you can't enable the Vertex AI integration in Cloud SQL. Upgrade your machine type to dedicated core. For more information, see Machine Type. Error message: Google ML Integration is unsupported for this maintenance version. Please follow https://cloud.google.com/sql/docs/mysql/self-service-maintenance to update the maintenance version of the instance. To enable the Vertex AI integration in Cloud SQL, the maintenance version of your instance must be R20240130 or later. To upgrade your instance to this version, see Self-service maintenance. Error message: Cannot invoke ml_predict_row if 'cloudsql.enable_google_ml_integration' is off. The cloudsql.enable_google_ml_integration database flag is turned off. Cloud SQL can't integrate with Vertex AI.

    To turn this flag on, use the gcloud sql instances patch command:

    gcloud sql instances patch INSTANCE_NAME --database-flags cloudsql.enable_google_ml_integration=on

    Replace INSTANCE_NAME with the name of the primary Cloud SQL instance.

    Error message: Failed to connect to remote host: Connection refused. The integration between Cloud SQL and Vertex AI isn't enabled. To enable this integration, use the gcloud sql instances patch command:

    gcloud sql instances patch INSTANCE_NAME
    --enable-google-ml-integration

    Replace INSTANCE_NAME with the name of the primary Cloud SQL instance.

    Error message: Vertex AI API has not been used in project PROJECT_ID before or it is disabled. Enable it by visiting /apis/api/aiplatform.googleapis.com/overview?project=PROJECT_ID then retry. The Vertex AI API isn't enabled. For more information on enabling this API, see Enable database integration with Vertex AI. Error message: Permission 'aiplatform.endpoints.predict' denied on resource. Vertex AI permissions aren't added to the Cloud SQL service account for the project where the Cloud SQL instance is located. For more information on adding these permissions to the service account, see Enable database integration with Vertex AI. Error message: Publisher Model `projects/PROJECT_ID/locations/REGION_NAME/publishers/google/models/MODEL_NAME` not found. The machine learning model or the LLM doesn't exist in Vertex AI. Error message: Resource exhausted: grpc: received message larger than max. The size of the request that Cloud SQL passes to Vertex AI exceeds the gRPC limit of 4 MB per request. Error message: Cloud SQL attempts to send a request to Vertex AI. However, the instance is in the %s region, but the Vertex AI endpoint is in the %s region. Make sure the instance and endpoint are in the same region. Cloud SQL attempts to send a request to Vertex AI. However, the instance is in one region, but the Vertex AI endpoint is in a different region. To resolve this issue, both the instance and endpoint must be in the same region. Error message: The Vertex AI endpoint isn't formatted properly. The Vertex AI endpoint isn't formatted properly. For more information, see Use private endpoints for online prediction. Error message: Quota exceeded for aiplatform.googleapis.com/online_prediction_requests_per_base_model with base model: textembedding-gecko. The number of requests that Cloud SQL passes to Vertex AI exceeds the limit of 1,500 requests per minute per region per model per project.

    RetroSearch is an open source project built by @garambo | Open a GitHub Issue

    Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

    HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4