mapping_rules
Creates, updates, deletes, gets or lists a mapping_rules resource.
Overview
| Name | mapping_rules |
| Type | Resource |
| Id | google.datamigration.mapping_rules |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Full name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}. |
conditionalColumnSetValue | object | Optional. Rule to specify how the data contained in a column should be transformed (such as trimmed, rounded, etc) provided that the data meets certain criteria. (id: ConditionalColumnSetValue) |
convertRowidColumn | object | Optional. Rule to specify how multiple tables should be converted with an additional rowid column. (id: ConvertRowIdToColumn) |
displayName | string | Optional. A human readable name |
entityMove | object | Optional. Rule to specify how multiple entities should be relocated into a different schema. (id: EntityMove) |
filter | object | Required. The rule filter (id: MappingRuleFilter) |
filterTableColumns | object | Optional. Rule to specify the list of columns to include or exclude from a table. (id: FilterTableColumns) |
multiColumnDataTypeChange | object | Optional. Rule to specify how multiple columns should be converted to a different data type. (id: MultiColumnDatatypeChange) |
multiEntityRename | object | Optional. Rule to specify how multiple entities should be renamed. (id: MultiEntityRename) |
revisionCreateTime | string (google-datetime) | Output only. The timestamp that the revision was created. |
revisionId | string | Output 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. |
ruleOrder | string (int64) | Required. The order in which the rule is applied. Lower order rules are applied before higher value rules so they may end up being overridden. |
ruleScope | string | Required. The rule scope (DATABASE_ENTITY_TYPE_UNSPECIFIED, DATABASE_ENTITY_TYPE_SCHEMA, DATABASE_ENTITY_TYPE_TABLE, DATABASE_ENTITY_TYPE_COLUMN, DATABASE_ENTITY_TYPE_CONSTRAINT, DATABASE_ENTITY_TYPE_INDEX, DATABASE_ENTITY_TYPE_TRIGGER, DATABASE_ENTITY_TYPE_VIEW, DATABASE_ENTITY_TYPE_SEQUENCE, DATABASE_ENTITY_TYPE_STORED_PROCEDURE, DATABASE_ENTITY_TYPE_FUNCTION, DATABASE_ENTITY_TYPE_SYNONYM, DATABASE_ENTITY_TYPE_DATABASE_PACKAGE, DATABASE_ENTITY_TYPE_UDT, DATABASE_ENTITY_TYPE_MATERIALIZED_VIEW, DATABASE_ENTITY_TYPE_DATABASE) |
setTablePrimaryKey | object | Optional. Rule to specify the primary key for a table (id: SetTablePrimaryKey) |
singleColumnChange | object | Optional. Rule to specify how a single column is converted. (id: SingleColumnChange) |
singleEntityRename | object | Optional. Rule to specify how a single entity should be renamed. (id: SingleEntityRename) |
singlePackageChange | object | Optional. Rule to specify how a single package is converted. (id: SinglePackageChange) |
sourceSqlChange | object | Optional. Rule to change the sql code for an entity, for example, function, procedure. (id: SourceSqlChange) |
state | string | Optional. The mapping rule state (STATE_UNSPECIFIED, ENABLED, DISABLED, DELETED) |
| Name | Datatype | Description |
|---|---|---|
name | string | Full name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}. |
conditionalColumnSetValue | object | Optional. Rule to specify how the data contained in a column should be transformed (such as trimmed, rounded, etc) provided that the data meets certain criteria. (id: ConditionalColumnSetValue) |
convertRowidColumn | object | Optional. Rule to specify how multiple tables should be converted with an additional rowid column. (id: ConvertRowIdToColumn) |
displayName | string | Optional. A human readable name |
entityMove | object | Optional. Rule to specify how multiple entities should be relocated into a different schema. (id: EntityMove) |
filter | object | Required. The rule filter (id: MappingRuleFilter) |
filterTableColumns | object | Optional. Rule to specify the list of columns to include or exclude from a table. (id: FilterTableColumns) |
multiColumnDataTypeChange | object | Optional. Rule to specify how multiple columns should be converted to a different data type. (id: MultiColumnDatatypeChange) |
multiEntityRename | object | Optional. Rule to specify how multiple entities should be renamed. (id: MultiEntityRename) |
revisionCreateTime | string (google-datetime) | Output only. The timestamp that the revision was created. |
revisionId | string | Output 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. |
ruleOrder | string (int64) | Required. The order in which the rule is applied. Lower order rules are applied before higher value rules so they may end up being overridden. |
ruleScope | string | Required. The rule scope (DATABASE_ENTITY_TYPE_UNSPECIFIED, DATABASE_ENTITY_TYPE_SCHEMA, DATABASE_ENTITY_TYPE_TABLE, DATABASE_ENTITY_TYPE_COLUMN, DATABASE_ENTITY_TYPE_CONSTRAINT, DATABASE_ENTITY_TYPE_INDEX, DATABASE_ENTITY_TYPE_TRIGGER, DATABASE_ENTITY_TYPE_VIEW, DATABASE_ENTITY_TYPE_SEQUENCE, DATABASE_ENTITY_TYPE_STORED_PROCEDURE, DATABASE_ENTITY_TYPE_FUNCTION, DATABASE_ENTITY_TYPE_SYNONYM, DATABASE_ENTITY_TYPE_DATABASE_PACKAGE, DATABASE_ENTITY_TYPE_UDT, DATABASE_ENTITY_TYPE_MATERIALIZED_VIEW, DATABASE_ENTITY_TYPE_DATABASE) |
setTablePrimaryKey | object | Optional. Rule to specify the primary key for a table (id: SetTablePrimaryKey) |
singleColumnChange | object | Optional. Rule to specify how a single column is converted. (id: SingleColumnChange) |
singleEntityRename | object | Optional. Rule to specify how a single entity should be renamed. (id: SingleEntityRename) |
singlePackageChange | object | Optional. Rule to specify how a single package is converted. (id: SinglePackageChange) |
sourceSqlChange | object | Optional. Rule to change the sql code for an entity, for example, function, procedure. (id: SourceSqlChange) |
state | string | Optional. The mapping rule state (STATE_UNSPECIFIED, ENABLED, DISABLED, DELETED) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | projectsId, locationsId, conversionWorkspacesId, mappingRulesId | Gets the details of a mapping rule. | |
list | select | projectsId, locationsId, conversionWorkspacesId | pageSize, pageToken | Lists the mapping rules for a specific conversion workspace. |
create | insert | projectsId, locationsId, conversionWorkspacesId | requestId, mappingRuleId | Creates a new mapping rule for a given conversion workspace. |
delete | delete | projectsId, locationsId, conversionWorkspacesId, mappingRulesId | requestId | Deletes a single mapping rule. |
import | exec | projectsId, locationsId, conversionWorkspacesId | Imports the mapping rules for a given conversion workspace. Supports various formats of external rules files. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
conversionWorkspacesId | string | |
locationsId | string | |
mappingRulesId | string | |
projectsId | string | |
mappingRuleId | string | |
pageSize | integer (int32) | |
pageToken | string | |
requestId | string |
SELECT examples
- get
- list
Gets the details of a mapping rule.
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 projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND conversionWorkspacesId = '{{ conversionWorkspacesId }}' -- required
AND mappingRulesId = '{{ mappingRulesId }}' -- required
;
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 projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND conversionWorkspacesId = '{{ conversionWorkspacesId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- create
- Manifest
Creates a new mapping rule for a given conversion workspace.
INSERT INTO google.datamigration.mapping_rules (
data__ruleScope,
data__multiEntityRename,
data__conditionalColumnSetValue,
data__name,
data__singlePackageChange,
data__sourceSqlChange,
data__setTablePrimaryKey,
data__state,
data__entityMove,
data__filterTableColumns,
data__displayName,
data__multiColumnDataTypeChange,
data__convertRowidColumn,
data__singleColumnChange,
data__filter,
data__ruleOrder,
data__singleEntityRename,
projectsId,
locationsId,
conversionWorkspacesId,
requestId,
mappingRuleId
)
SELECT
'{{ ruleScope }}',
'{{ multiEntityRename }}',
'{{ conditionalColumnSetValue }}',
'{{ name }}',
'{{ singlePackageChange }}',
'{{ sourceSqlChange }}',
'{{ setTablePrimaryKey }}',
'{{ state }}',
'{{ entityMove }}',
'{{ filterTableColumns }}',
'{{ displayName }}',
'{{ multiColumnDataTypeChange }}',
'{{ convertRowidColumn }}',
'{{ singleColumnChange }}',
'{{ filter }}',
'{{ ruleOrder }}',
'{{ singleEntityRename }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ conversionWorkspacesId }}',
'{{ requestId }}',
'{{ mappingRuleId }}'
RETURNING
name,
conditionalColumnSetValue,
convertRowidColumn,
displayName,
entityMove,
filter,
filterTableColumns,
multiColumnDataTypeChange,
multiEntityRename,
revisionCreateTime,
revisionId,
ruleOrder,
ruleScope,
setTablePrimaryKey,
singleColumnChange,
singleEntityRename,
singlePackageChange,
sourceSqlChange,
state
;
# Description fields are for documentation purposes
- name: mapping_rules
props:
- name: projectsId
value: "{{ projectsId }}"
description: Required parameter for the mapping_rules resource.
- name: locationsId
value: "{{ locationsId }}"
description: Required parameter for the mapping_rules resource.
- name: conversionWorkspacesId
value: "{{ conversionWorkspacesId }}"
description: Required parameter for the mapping_rules resource.
- name: ruleScope
value: "{{ ruleScope }}"
description: |
Required. The rule scope
valid_values: ['DATABASE_ENTITY_TYPE_UNSPECIFIED', 'DATABASE_ENTITY_TYPE_SCHEMA', 'DATABASE_ENTITY_TYPE_TABLE', 'DATABASE_ENTITY_TYPE_COLUMN', 'DATABASE_ENTITY_TYPE_CONSTRAINT', 'DATABASE_ENTITY_TYPE_INDEX', 'DATABASE_ENTITY_TYPE_TRIGGER', 'DATABASE_ENTITY_TYPE_VIEW', 'DATABASE_ENTITY_TYPE_SEQUENCE', 'DATABASE_ENTITY_TYPE_STORED_PROCEDURE', 'DATABASE_ENTITY_TYPE_FUNCTION', 'DATABASE_ENTITY_TYPE_SYNONYM', 'DATABASE_ENTITY_TYPE_DATABASE_PACKAGE', 'DATABASE_ENTITY_TYPE_UDT', 'DATABASE_ENTITY_TYPE_MATERIALIZED_VIEW', 'DATABASE_ENTITY_TYPE_DATABASE']
- name: multiEntityRename
description: |
Optional. Rule to specify how multiple entities should be renamed.
value:
newNamePattern: "{{ newNamePattern }}"
sourceNameTransformation: "{{ sourceNameTransformation }}"
- name: conditionalColumnSetValue
description: |
Optional. Rule to specify how the data contained in a column should be transformed (such as trimmed, rounded, etc) provided that the data meets certain criteria.
value:
sourceTextFilter:
sourceMinLengthFilter: "{{ sourceMinLengthFilter }}"
sourceMaxLengthFilter: "{{ sourceMaxLengthFilter }}"
customFeatures: "{{ customFeatures }}"
sourceNumericFilter:
numericFilterOption: "{{ numericFilterOption }}"
sourceMinScaleFilter: {{ sourceMinScaleFilter }}
sourceMinPrecisionFilter: {{ sourceMinPrecisionFilter }}
sourceMaxPrecisionFilter: {{ sourceMaxPrecisionFilter }}
sourceMaxScaleFilter: {{ sourceMaxScaleFilter }}
valueTransformation:
intComparison:
valueComparison: "{{ valueComparison }}"
value: "{{ value }}"
roundScale:
scale: {{ scale }}
doubleComparison:
valueComparison: "{{ valueComparison }}"
value: {{ value }}
assignMinValue: "{{ assignMinValue }}"
assignSpecificValue:
value: "{{ value }}"
assignNull: "{{ assignNull }}"
valueList:
ignoreCase: {{ ignoreCase }}
valuePresentList: "{{ valuePresentList }}"
values:
- "{{ values }}"
isNull: "{{ isNull }}"
assignMaxValue: "{{ assignMaxValue }}"
applyHash:
uuidFromBytes: "{{ uuidFromBytes }}"
- name: name
value: "{{ name }}"
description: |
Full name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}.
- name: singlePackageChange
description: |
Optional. Rule to specify how a single package is converted.
value:
packageDescription: "{{ packageDescription }}"
packageBody: "{{ packageBody }}"
- name: sourceSqlChange
description: |
Optional. Rule to change the sql code for an entity, for example, function, procedure.
value:
sqlCode: "{{ sqlCode }}"
- name: setTablePrimaryKey
description: |
Optional. Rule to specify the primary key for a table
value:
primaryKeyColumns:
- "{{ primaryKeyColumns }}"
primaryKey: "{{ primaryKey }}"
- name: state
value: "{{ state }}"
description: |
Optional. The mapping rule state
valid_values: ['STATE_UNSPECIFIED', 'ENABLED', 'DISABLED', 'DELETED']
- name: entityMove
description: |
Optional. Rule to specify how multiple entities should be relocated into a different schema.
value:
newSchema: "{{ newSchema }}"
- name: filterTableColumns
description: |
Optional. Rule to specify the list of columns to include or exclude from a table.
value:
includeColumns:
- "{{ includeColumns }}"
excludeColumns:
- "{{ excludeColumns }}"
- name: displayName
value: "{{ displayName }}"
description: |
Optional. A human readable name
- name: multiColumnDataTypeChange
description: |
Optional. Rule to specify how multiple columns should be converted to a different data type.
value:
newDataType: "{{ newDataType }}"
overrideLength: "{{ overrideLength }}"
sourceTextFilter:
sourceMinLengthFilter: "{{ sourceMinLengthFilter }}"
sourceMaxLengthFilter: "{{ sourceMaxLengthFilter }}"
customFeatures: "{{ customFeatures }}"
overrideScale: {{ overrideScale }}
overrideFractionalSecondsPrecision: {{ overrideFractionalSecondsPrecision }}
sourceNumericFilter:
numericFilterOption: "{{ numericFilterOption }}"
sourceMinScaleFilter: {{ sourceMinScaleFilter }}
sourceMinPrecisionFilter: {{ sourceMinPrecisionFilter }}
sourceMaxPrecisionFilter: {{ sourceMaxPrecisionFilter }}
sourceMaxScaleFilter: {{ sourceMaxScaleFilter }}
sourceDataTypeFilter: "{{ sourceDataTypeFilter }}"
overridePrecision: {{ overridePrecision }}
- name: convertRowidColumn
description: |
Optional. Rule to specify how multiple tables should be converted with an additional rowid column.
value:
onlyIfNoPrimaryKey: {{ onlyIfNoPrimaryKey }}
- name: singleColumnChange
description: |
Optional. Rule to specify how a single column is converted.
value:
precision: {{ precision }}
udt: {{ udt }}
array: {{ array }}
nullable: {{ nullable }}
collation: "{{ collation }}"
customFeatures: "{{ customFeatures }}"
setValues:
- "{{ setValues }}"
dataType: "{{ dataType }}"
scale: {{ scale }}
autoGenerated: {{ autoGenerated }}
fractionalSecondsPrecision: {{ fractionalSecondsPrecision }}
length: "{{ length }}"
charset: "{{ charset }}"
arrayLength: {{ arrayLength }}
comment: "{{ comment }}"
- name: filter
description: |
Required. The rule filter
value:
parentEntity: "{{ parentEntity }}"
entityNameContains: "{{ entityNameContains }}"
entityNameSuffix: "{{ entityNameSuffix }}"
entityNamePrefix: "{{ entityNamePrefix }}"
entities:
- "{{ entities }}"
- name: ruleOrder
value: "{{ ruleOrder }}"
description: |
Required. The order in which the rule is applied. Lower order rules are applied before higher value rules so they may end up being overridden.
- name: singleEntityRename
description: |
Optional. Rule to specify how a single entity should be renamed.
value:
newName: "{{ newName }}"
- name: requestId
value: "{{ requestId }}"
- name: mappingRuleId
value: "{{ mappingRuleId }}"
DELETE examples
- delete
Deletes a single mapping rule.
DELETE FROM google.datamigration.mapping_rules
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND conversionWorkspacesId = '{{ conversionWorkspacesId }}' --required
AND mappingRulesId = '{{ mappingRulesId }}' --required
AND requestId = '{{ requestId }}'
;
Lifecycle Methods
- import
Imports the mapping rules for a given conversion workspace. Supports various formats of external rules files.
EXEC google.datamigration.mapping_rules.import
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@conversionWorkspacesId='{{ conversionWorkspacesId }}' --required
@@json=
'{
"autoCommit": {{ autoCommit }},
"rulesFiles": "{{ rulesFiles }}",
"rulesFormat": "{{ rulesFormat }}"
}'
;