Puedes usar la instrucción de la herramienta Google Databases @GoogleDatabases en el chat de Gemini Code Assist para generar código de la aplicación compatible con bases de datos para Cloud SQL en tu entorno de desarrollo integrado (IDE).
Antes de comenzar
Un administrador debe realizar los primeros tres pasos, y los desarrolladores individuales pueden completar el paso restante.
Instala la herramienta Google Databases en tu IDE siguiendo los pasos que se indican en Configura herramientas.
Genera una función
En tu IDE, navega al chat de Gemini Code Assist y, luego, ingresa la siguiente instrucción:
@GoogleDatabases generate a function FEATURE
Reemplaza FEATURE por el requisito de la función para la que deseas generar código. Por ejemplo, puedes generar una función para obtener clientes por ID ingresando la siguiente instrucción: @GoogleDatabases generate a function to get customers by ID
La herramienta Google Databases de Gemini Code Assist devuelve código que tiene en cuenta la base de datos para el requisito de la función.
Instrucciones adicionales
Se recomiendan las siguientes instrucciones para la herramienta Google Databases:
@GoogleDatabases generate a function that gets a sales comparison between the last two months
@GoogleDatabases generate a function that returns the top 5 selling items over the past week
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-19 (UTC)"],[],[],null,["# Generate database-aware code with the Google Databases Gemini Code Assist tool\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/generate-functions-with-googledatabases-gemini-tool \"View this page for the MySQL database engine\") \\| [PostgreSQL](/sql/docs/postgres/generate-functions-with-googledatabases-gemini-tool \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThe Gemini Code Assist Google Databases tool is available as part of\n[Gemini Code Assist Standard and Enterprise edition](/gemini/docs/codeassist/overview).\n\nYou can use the Google Databases tool prompt `@GoogleDatabases` in the\nGemini Code Assist chat to generate database-aware application code for\nCloud SQL in your integrated development environment (IDE).\n\nBefore you begin\n----------------\n\nThe first three steps should be done by an administrator, and the remaining step\ncan be completed by individual developers.\n\n1. [Install Gemini Code Assist](/gemini/docs/discover/set-up-gemini).\n2. Enable Data Catalog in Cloud SQL by following the instructions in [Manage your Cloud SQL resources using Data Catalog](/sql/docs/sqlserver/dataplex-catalog-integration).\n3. Enable the Google Databases tool for users by following the steps in [Enable Gemini Code Assist tools](/gemini/docs/codeassist/tools-agents/enable-tools).\n4. Install the Google Databases tool in your IDE by following the steps in [Configure tools](/gemini/docs/codeassist/tools-agents/configure-tools).\n\nGenerate a function\n-------------------\n\n1. In your IDE, navigate to the Gemini Code Assist chat and enter the\n following prompt:\n\n @GoogleDatabases generate a function \u003cvar translate=\"no\"\u003eFEATURE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eFEATURE\u003c/var\u003e with the feature requirement that you want to\n generate code for. For example, you could generate a function to get\n customers by ID by entering the following prompt:\n `@GoogleDatabases generate a function to get customers by ID`\n\n The Gemini Code Assist Google Databases tool returns database-aware\n code for the feature requirement.\n\nAdditional prompts\n------------------\n\nThe following prompts are recommended for the Google Databases tool:\n\n- `@GoogleDatabases generate a function that gets a sales comparison between\n the last two months`\n- `@GoogleDatabases generate a function that returns the top 5 selling items\n over the past week`\n\nWhat's next\n-----------\n\n- Learn more about Gemini Code Assist tools by reading the [Tools overview](/gemini/docs/codeassist/tools-agents/tools-overview)."]]