Puoi utilizzare il prompt dello strumento Google Databases @GoogleDatabases nella chat di Gemini Code Assist per generare codice dell'applicazione compatibile con il database per Cloud SQL nel tuo ambiente di sviluppo integrato (IDE).
Prima di iniziare
I primi tre passaggi devono essere eseguiti da un amministratore, mentre il passaggio rimanente
può essere completato dai singoli sviluppatori.
Installa lo strumento Google Databases nel tuo IDE seguendo i passaggi descritti in
Configurare gli strumenti.
Genera una funzione
Nel tuo IDE, vai alla chat di Gemini Code Assist e inserisci il
seguente prompt:
@GoogleDatabases generate a function FEATURE
Sostituisci FEATURE con il requisito della funzionalità per cui vuoi generare il codice. Ad esempio, puoi generare una funzione per ottenere
i clienti per ID inserendo il seguente prompt:
@GoogleDatabases generate a function to get customers by ID
Lo strumento Gemini Code Assist Google Databases restituisce codice
compatibile con il database per il requisito della funzionalità.
Prompt aggiuntivi
Per lo strumento Google Databases sono consigliati i seguenti prompt:
@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
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Generate database-aware code with the Google Databases Gemini Code Assist tool\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/generate-functions-with-googledatabases-gemini-tool \"View this page for the PostgreSQL database engine\") \\| [SQL Server](/sql/docs/sqlserver/generate-functions-with-googledatabases-gemini-tool \"View this page for the SQL Server database engine\")\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/mysql/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)."]]