Skip to main content

mapping_rules

Creates, updates, deletes, gets or lists a mapping_rules resource.

Overview

Namemapping_rules
TypeResource
Idgoogle.datamigration.mapping_rules

Fields

NameDatatypeDescription
namestringFull name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}.
conditionalColumnSetValueobjectOptions to configure rule type ConditionalColumnSetValue. The rule is used to transform the data which is being replicated/migrated. The rule filter field can refer to one or more entities. The rule scope can be one of: Column.
convertRowidColumnobjectOptions to configure rule type ConvertROWIDToColumn. The rule is used to add column rowid to destination tables based on an Oracle rowid function/property. The rule filter field can refer to one or more entities. The rule scope can be one of: Table. This rule requires additional filter to be specified beyond the basic rule filter field, which is whether or not to work on tables which already have a primary key defined.
displayNamestringOptional. A human readable name
entityMoveobjectOptions to configure rule type EntityMove. The rule is used to move an entity to a new schema. The rule filter field can refer to one or more entities. The rule scope can be one of: Table, Column, Constraint, Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT
filterobjectA filter defining the entities that a mapping rule should be applied to. When more than one field is specified, the rule is applied only to entities which match all the fields.
filterTableColumnsobjectOptions to configure rule type FilterTableColumns. The rule is used to filter the list of columns to include or exclude from a table. The rule filter field can refer to one entity. The rule scope can be: Table Only one of the two lists can be specified for the rule.
multiColumnDataTypeChangeobjectOptions to configure rule type MultiColumnDatatypeChange. The rule is used to change the data type and associated properties of multiple columns at once. The rule filter field can refer to one or more entities. The rule scope can be one of:Column. This rule requires additional filters to be specified beyond the basic rule filter field, which is the source data type, but the rule supports additional filtering capabilities such as the minimum and maximum field length. All additional filters which are specified are required to be met in order for the rule to be applied (logical AND between the fields).
multiEntityRenameobjectOptions to configure rule type MultiEntityRename. The rule is used to rename multiple entities. The rule filter field can refer to one or more entities. The rule scope can be one of: Database, Schema, Table, Column, Constraint, Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT
revisionCreateTimestringOutput only. The timestamp that the revision was created.
revisionIdstringOutput only. The revision ID of the mapping rule. A new revision is committed whenever the mapping rule is changed in any way. The format is an 8-character hexadecimal string.
ruleOrderstringRequired. The order in which the rule is applied. Lower order rules are applied before higher value rules so they may end up being overridden.
ruleScopestringRequired. The rule scope
setTablePrimaryKeyobjectOptions to configure rule type SetTablePrimaryKey. The rule is used to specify the columns and name to configure/alter the primary key of a table. The rule filter field can refer to one entity. The rule scope can be one of: Table.
singleColumnChangeobjectOptions to configure rule type SingleColumnChange. The rule is used to change the properties of a column. The rule filter field can refer to one entity. The rule scope can be one of: Column. When using this rule, if a field is not specified than the destination column's configuration will be the same as the one in the source column..
singleEntityRenameobjectOptions to configure rule type SingleEntityRename. The rule is used to rename an entity. The rule filter field can refer to only one entity. The rule scope can be one of: Database, Schema, Table, Column, Constraint, Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT, Synonym
singlePackageChangeobjectOptions to configure rule type SinglePackageChange. The rule is used to alter the sql code for a package entities. The rule filter field can refer to one entity. The rule scope can be: Package
sourceSqlChangeobjectOptions to configure rule type SourceSqlChange. The rule is used to alter the sql code for database entities. The rule filter field can refer to one entity. The rule scope can be: StoredProcedure, Function, Trigger, View
statestringOptional. The mapping rule state

Methods

NameAccessible byRequired ParamsDescription
getSELECTconversionWorkspacesId, locationsId, mappingRulesId, projectsIdGets the details of a mapping rule.
listSELECTconversionWorkspacesId, locationsId, projectsIdLists the mapping rules for a specific conversion workspace.
createINSERTconversionWorkspacesId, locationsId, projectsIdCreates a new mapping rule for a given conversion workspace.
deleteDELETEconversionWorkspacesId, locationsId, mappingRulesId, projectsIdDeletes a single mapping rule.
importEXECconversionWorkspacesId, locationsId, projectsIdImports the mapping rules for a given conversion workspace. Supports various formats of external rules files.

SELECT examples

Lists the mapping rules for a specific conversion workspace.

SELECT
name,
conditionalColumnSetValue,
convertRowidColumn,
displayName,
entityMove,
filter,
filterTableColumns,
multiColumnDataTypeChange,
multiEntityRename,
revisionCreateTime,
revisionId,
ruleOrder,
ruleScope,
setTablePrimaryKey,
singleColumnChange,
singleEntityRename,
singlePackageChange,
sourceSqlChange,
state
FROM google.datamigration.mapping_rules
WHERE conversionWorkspacesId = '{{ conversionWorkspacesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new mapping_rules resource.

/*+ create */
INSERT INTO google.datamigration.mapping_rules (
conversionWorkspacesId,
locationsId,
projectsId,
name,
displayName,
state,
ruleScope,
filter,
ruleOrder,
singleEntityRename,
multiEntityRename,
entityMove,
singleColumnChange,
multiColumnDataTypeChange,
conditionalColumnSetValue,
convertRowidColumn,
setTablePrimaryKey,
singlePackageChange,
sourceSqlChange,
filterTableColumns
)
SELECT
'{{ conversionWorkspacesId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ displayName }}',
'{{ state }}',
'{{ ruleScope }}',
'{{ filter }}',
'{{ ruleOrder }}',
'{{ singleEntityRename }}',
'{{ multiEntityRename }}',
'{{ entityMove }}',
'{{ singleColumnChange }}',
'{{ multiColumnDataTypeChange }}',
'{{ conditionalColumnSetValue }}',
'{{ convertRowidColumn }}',
'{{ setTablePrimaryKey }}',
'{{ singlePackageChange }}',
'{{ sourceSqlChange }}',
'{{ filterTableColumns }}'
;

DELETE example

Deletes the specified mapping_rules resource.

/*+ delete */
DELETE FROM google.datamigration.mapping_rules
WHERE conversionWorkspacesId = '{{ conversionWorkspacesId }}'
AND locationsId = '{{ locationsId }}'
AND mappingRulesId = '{{ mappingRulesId }}'
AND projectsId = '{{ projectsId }}';