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
Successful response
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 |
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 |
Successful response
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 |
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 |
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 | mappingRuleId , requestId | 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__name,
data__displayName,
data__state,
data__ruleScope,
data__filter,
data__ruleOrder,
data__singleEntityRename,
data__multiEntityRename,
data__entityMove,
data__singleColumnChange,
data__multiColumnDataTypeChange,
data__conditionalColumnSetValue,
data__convertRowidColumn,
data__setTablePrimaryKey,
data__singlePackageChange,
data__sourceSqlChange,
data__filterTableColumns,
projectsId,
locationsId,
conversionWorkspacesId,
mappingRuleId,
requestId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ state }}',
'{{ ruleScope }}',
'{{ filter }}',
'{{ ruleOrder }}',
'{{ singleEntityRename }}',
'{{ multiEntityRename }}',
'{{ entityMove }}',
'{{ singleColumnChange }}',
'{{ multiColumnDataTypeChange }}',
'{{ conditionalColumnSetValue }}',
'{{ convertRowidColumn }}',
'{{ setTablePrimaryKey }}',
'{{ singlePackageChange }}',
'{{ sourceSqlChange }}',
'{{ filterTableColumns }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ conversionWorkspacesId }}',
'{{ mappingRuleId }}',
'{{ requestId }}'
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: string
description: Required parameter for the mapping_rules resource.
- name: locationsId
value: string
description: Required parameter for the mapping_rules resource.
- name: conversionWorkspacesId
value: string
description: Required parameter for the mapping_rules resource.
- name: name
value: string
description: >
Full name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}.
- name: displayName
value: string
description: >
Optional. A human readable name
- name: state
value: string
description: >
Optional. The mapping rule state
valid_values: ['STATE_UNSPECIFIED', 'ENABLED', 'DISABLED', 'DELETED']
- name: ruleScope
value: string
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: filter
value: object
description: >
Required. The rule filter
- name: ruleOrder
value: string
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
value: object
description: >
Optional. Rule to specify how a single entity should be renamed.
- name: multiEntityRename
value: object
description: >
Optional. Rule to specify how multiple entities should be renamed.
- name: entityMove
value: object
description: >
Optional. Rule to specify how multiple entities should be relocated into a different schema.
- name: singleColumnChange
value: object
description: >
Optional. Rule to specify how a single column is converted.
- name: multiColumnDataTypeChange
value: object
description: >
Optional. Rule to specify how multiple columns should be converted to a different data type.
- name: conditionalColumnSetValue
value: object
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.
- name: convertRowidColumn
value: object
description: >
Optional. Rule to specify how multiple tables should be converted with an additional rowid column.
- name: setTablePrimaryKey
value: object
description: >
Optional. Rule to specify the primary key for a table
- name: singlePackageChange
value: object
description: >
Optional. Rule to specify how a single package is converted.
- name: sourceSqlChange
value: object
description: >
Optional. Rule to change the sql code for an entity, for example, function, procedure.
- name: filterTableColumns
value: object
description: >
Optional. Rule to specify the list of columns to include or exclude from a table.
- name: mappingRuleId
value: string
- name: requestId
value: string
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=
'{
"rulesFormat": "{{ rulesFormat }}",
"rulesFiles": "{{ rulesFiles }}",
"autoCommit": {{ autoCommit }}
}';