Use o comando da ferramenta de bancos de dados do Google @GoogleDatabases no
chat da Assistência de código do Gemini para gerar código de aplicativo compatível com bancos de dados para
o Cloud SQL no seu ambiente de desenvolvimento integrado (IDE).
Antes de começar
As três primeiras etapas precisam ser realizadas por um administrador, e a etapa restante
pode ser concluída por desenvolvedores individuais.
Instale a ferramenta Google Databases na sua IDE seguindo as etapas em
Configurar ferramentas.
Gerar uma função
No ambiente de desenvolvimento integrado, navegue até a conversa do Gemini Code Assist e insira o
comando a seguir:
@GoogleDatabases generate a function FEATURE
Substitua FEATURE pelo requisito de recurso para o qual você quer gerar código. Por exemplo, você pode gerar uma função para receber
clientes por ID inserindo o seguinte comando:
@GoogleDatabases generate a function to get customers by ID
A ferramenta de bancos de dados do Google do Gemini Code Assist retorna código compatível com banco de dados para o requisito de recurso.
Outros comandos
Recomendamos os seguintes comandos para a ferramenta 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 entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 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)."]]