Anda dapat menggunakan perintah alat Google Database @GoogleDatabases di chat Gemini Code Assist untuk membuat kode aplikasi yang kompatibel dengan database untuk Cloud SQL di lingkungan pengembangan terintegrasi (IDE) Anda.
Sebelum memulai
Tiga langkah pertama harus dilakukan oleh administrator, dan langkah yang tersisa dapat diselesaikan oleh masing-masing developer.
Instal alat Google Database di IDE Anda dengan mengikuti langkah-langkah di
Mengonfigurasi alat.
Membuat fungsi
Di IDE Anda, buka chat Gemini Code Assist dan masukkan perintah berikut:
@GoogleDatabases generate a function FEATURE
Ganti FEATURE dengan persyaratan fitur yang ingin Anda
buatkan kodenya. Misalnya, Anda dapat membuat fungsi untuk mendapatkan pelanggan menurut ID dengan memasukkan perintah berikut:
@GoogleDatabases generate a function to get customers by ID
Alat Google Database Gemini Code Assist menampilkan kode yang kompatibel dengan database untuk persyaratan fitur.
Perintah tambahan
Perintah berikut direkomendasikan untuk alat Google Database:
@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
Langkah berikutnya
Pelajari lebih lanjut alat Gemini Code Assist dengan membaca
Ringkasan alat.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]