Database Migration Service integrates Gemini for Google Cloud into the conversion workspaces to help you speed up and improve the conversion process in the following areas:
-
Enhance the deterministic conversion results with Gemini-powered auto-conversion to use the power of AI to significantly reduce the number of manual adjustments needed in your PostgreSQL code.
- Provide code explainability features with the conversion assistant: a set of dedicated prompts that can help you better understand the conversion logic, propose fixes for conversion issues, or optimize converted code.
- Verify converted code with Gemini quality assessments. Gemini can help analyze the converted code for correctness and functional equivalence with your source code.
-
Expedite applying fixes for conversion issues with Gemini code conversion suggestions: a mechanism where the Gemini model can learn as you fix conversion issues and suggest changes to other faulty objects in the workspace.
You can also combine this feature with code explainability for a complete, end-to-end Gemini-powered code object conversion experience. For more information, see Example workflow for fixing code objects with conversion issues.
Your SQL code and schema are stored in the region where you create the conversion workspace. If you use assisted code and schema conversion with Gemini models, your code and schemas might be processed in other regions.
Learn how and when Gemini for Google Cloud uses your data.
Costs
To use Gemini assistance in Database Migration Service conversion workspaces you need to enable Gemini for Google Cloud API. Pricing for Gemini applies. For more information, see Gemini for Google Cloud pricing.
Before you begin
To use Gemini-powered features in Database Migration Service, enable Gemini for Google Cloud in your project.
After you enable Gemini for Google Cloud in your project, you can use all Gemini-powered conversion features in your workspace.
Required roles
To get the permissions that you need to use Gemini-enhanced
conversion features, ask your administrator to grant you the
Database Migration Admin (roles/datamigration.admin)
role on your project.
For more information about granting roles, see Manage access in the Identity and Access Management documentation.
This predefined role contains the permissions required to use Gemini-enhanced conversion features. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to perform heterogeneous SQL Server migrations with Database Migration Service:
datamigration.*cloudaicompanion.entitlements.get
Use Gemini auto-conversion
When you convert your source schema, Database Migration Service uses the deterministic conversion rules to create the PostgreSQL syntax equivalents. Auto-conversion integrates Gemini-powered corrections on top of the deterministic results to reduce the number of conversion issues and improve conversion quality.
You can perform additional quality and functional equivalence assessments for code objects enhanced with Gemini-powered corrections. For more information, see Gemini quality assessments.
To use auto-conversion, do the following:
- Create a new conversion workspace. Make sure you immediately upgrade it to use the latest streamlined experience.
- Go to Conversion workspaces and select your workspace.
- Enable auto-conversion for your workspace.
- Convert your source code and schema. Click
Convert source.
Database Migration Service automatically employs Gemini-powered enhancements in the conversion. You can use the tree view to see which objects are augmented with Gemini:
Figure 1. Source schema tree view with Gemini augmentation status. (click to enlarge)
In the tree view, select any augmented object to view the details of enhancements provided by auto-conversion. If you don't like the changes introduced by Gemini, click Use deterministic code instead to revert the object to the deterministic conversion results.
Figure 2. Gemini-powered auto-conversion panel where you can inspect the details of code and schema augmentations. (click to enlarge)
Enable auto-conversion
If you previously disabled auto-conversion, you can enable it in the Gemini panel:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Auto-conversion checkbox, and click Save settings.
Your conversion workspace will now auto-conversion when you convert your schema.
- Optional: In the Convert source objects with Gemini? dialog,
click Convert.
Your converted objects aren't modified when you enable auto-conversion. You can convert your schema again at a later time.
Disable auto-conversion
To disable auto-conversion, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Clear the Auto-conversion checkbox, and click Save settings.
Your conversion workspace will now use deterministic code and schema conversion when you convert your schema.
- Optional: In the Convert source objects? dialog, click
Convert.
Your converted objects aren't modified when you disable auto-conversion. You can convert your schema again at a later time if you want to revert the conversion results to use deterministic conversion rules.
Use Gemini conversion assistant
The conversion assistant is a set of dedicated prompts that you can use to gain a better understanding of the object conversion logic, ask for ideas on how to optimize code and remedy your conversion issues, or even add comments to your schema for self-documenting database objects.
Enable conversion assistant
Conversion assistant is enabled by default when you enable the Gemini for Google Cloud in your project. If you previously disabled the conversion assistant, you can enable it again in your workspace. To enable conversion assistant, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Conversion assistance checkbox, and click Save settings.
Disable conversion assistant
To disable conversion assistant, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Conversion assistance checkbox, and click Save settings.
Help me fix object conversion issues
The rule-based code and schema conversion engine might sometimes encounter issues when translating objects from Oracle to PostgreSQL. For example, certain Oracle functions might not have direct equivalents in PostgreSQL. You can use the Help me fix object conversion issues prompt to get a proposal of code changes that can fix the conversion issue.
This prompt is only available for editable code objects that have conversion issues. You can't view this prompt for other types of objects in the conversion workspace.
To use this prompt, do the following:
In the Google Cloud console, go to Conversion workspaces.
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the Oracle panel, select one of your Oracle objects.
In the object details view, select
Assist > Help me fix object conversion issues.
A pane with prompt results opens.
Verify the diff screen that shows proposed improvements. If you like the results, you can use the Insert suggestion button to update the converted object.
Repeat the steps for every faulty code object. As you apply the code proposals, Gemini models learn the pattern and can offer suggestions on how to propagate the fixes to all faulty objects in your workspace.
Explain the conversion logic for this object
With the Explain the conversion logic for this object prompt, you can get a step-by-step explanation of what the converted code does, including a summary of best practices applied in the new code.
To request an explanation of the object conversion logic, do the following:
In the Google Cloud console, go to Conversion workspaces.
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the Oracle panel, select one of your Oracle objects.
In the object details view, select
Assist > Explain the conversion logic for this object.
A pane with prompt results opens.
Help me optimize this code
Sometimes the results of rule-based code and schema conversion can be technically correct, but not fully optimized for PostgreSQL environments. You can use the