- Newest
- Most votes
- Most comments
One way to handle this is to use a column exclusion rule to exclude the generated column from the migration. This can be done by modifying the selection rule to include an exclude-columns parameter:
{ "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": { "schema-name": "test", "table-name": "Actor" }, "rule-action": "include", "filters": [ { "filter-type": "exclude", "column-name": "column_i_want_dms_to_ignore" } ] } ] }
The filters array within the selection rule includes a filter of type exclude to exclude the generated column
column_i_want_dms_to_ignore
from the migration.
Key Sources:
The following example transforms the table named Actor in your source to remove column collected from it in your target.
{
"rules": [{
"rule-type": "selection",
"rule-id": "1",
"rule-name": "1",
"object-locator": {
"schema-name": "test",
"table-name": "Actor"
},
"rule-action": "include"
}, {
"rule-type": "transformation",
"rule-id": "2",
"rule-name": "2",
"rule-action": "remove-column",
"rule-target": "column",
"object-locator": {
"schema-name": "test",
"table-name": "Actor",
"column-name": "collected"
}
}]
}
This removes the column, but I want to keep the column. Those generated (virtual) columns are generated by expression when changing other column on that table like:
`column_i_want_dms_to_ignore` tinyint(1) GENERATED ALWAYS AS (if((`second_column` is null),1,NULL)) VIRTUAL,
So you cant directly insert to it, but DMS somewhy does and gets error like: "The value specified for generated column 'blah' in table 'blah2' is not allowed."
So im looking transformation rule that ignores the column rather than deletes it.
This is the actual solution. My brain somehow neglected this as I thought it will remove the whole column from the table (schema). But in the column scope (rule-target) in the transformation rule it just removes the entry.
so basically you are looking to ignore a column to migrate to target which is there on source on target this column is autogenerated using expressions as defined on target table definition
basically yes. the table schema is the same in source and target.
to me looks like DMS wants to insert the value it got from the source to generated column on the target.
found similar case here : https://repost.aws/questions/QU4mngpXWVROuCNPorajoWKg/mysql-error-3105-when-replicating-from-mysql-to-aurora
Relevant content
- asked 9 months ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
This looks promising, didn't notice such selection rule option in GUI.
But can it be integrated to global selection rule, so DMS will import all tables in TEST database(schema), where some (Author, Auto) tables have generated columns. Something like:
Such json gives
Damn, according to manual
filter-type
can only besource
: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.Filters.html