问题描述
我在 MysqL 中有一个 varchar 以 json 列表格式存储,即:
['item1','item2']
我只需要通过 DMS 将数据发送到 DynamoDB 并将其存储为 DynamoDB 数组,即它应该像这样存储:
"my_column": {
"L": [
{
"S": "item_1"
},{
"S": "item_2"
}
]
}
我已经有了一些快速映射规则来转换时间戳并告诉主键和排序键属性
{
"rules": [
{
"rule-type": "selection","rule-id": "1","rule-name": "1","object-locator": {
"schema-name": "my_MysqL_db","table-name": "my_MysqL_table"
},"rule-action": "include"
},{
"rule-type": "object-mapping","rule-id": "2","rule-name": "2","rule-action": "map-record-to-record","target-table-name": "my_ddb_target","mapping-parameters": {
"partition-key-name": "account_id","sort-key-name": "id","exclude-columns": [
"created_at","updated_at","created_at_ts","updated_at_ts"
],"attribute-mappings": [
{
"target-attribute-name": "account_id","attribute-type": "scalar","attribute-sub-type": "string","value": "${account_id}"
},{
"target-attribute-name": "id","value": "${id}"
},{
"target-attribute-name": "created_at","attribute-sub-type": "number","value": "${created_at_ts}"
},{
"target-attribute-name": "updated_at","value": "${updated_at_ts}"
}
]
}
}
]
}
我尝试过类似的东西:
{
"rule-type": "transformation","rule-name": "RuleName 1","rule-action": "change-data-type","rule-target": "column","object-locator": {
"schema-name": "my_MysqL_db","table-name": "my_MysqL_table","column-name": "list_items","data-type": "string"
},"data-type": {
"type": "list"
}
}
但是它出错了,并且不允许我将它与其他规则一起保存,此外,我尝试按照文档重命名该列,例如 array_my_column
并且也不起作用。
我希望得到一些已经从 sql 到 ddb 数组迁移的人的反馈。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)