AWS GLUE Dynamodb – 在使用 Glue 迁移数据时如何保留空列为空。

huangapple go评论56阅读模式
英文:

AWS GLUE Dynamodb - How to retain empty columns as empty when migrating data in glue

问题

I'm trying to migrate the data from one dynamodb table which contains two columns(country, isMinor) as empty for few items to another dynamodb table.

But after migration it puts null values in target dynamodb table for these two missing columns

Is there any way this is possible. Appreciate quick help on this.

Thanks in advance.

例如,在源表中:

item1 = {
      "Name": {
        "S": "ABCD"
      },
      "Age": {
        "N": "10"
      }
    }
item2 = {
      "Name": {
        "S": "DEFG"
      },
      "Country": {
        "S": "XYZ"
      },
      "isMinor": {
        "BOOL": true
      },
      "Age": {
        "N": "11"
      }
    }

迁移后,item1 显示为:

item1 = {
      "Name": {
        "S": "ABCD"
      },
      "Country": {
        "NULL": true
      },
      "isMinor": {
        "NULL": true
      },
      "Age": {
        "N": "11"
      }

但迁移后目标 dynamodb 表的预期结果如下(与源表中的项目相同):

item1 = {
      "Name": {
        "S": "ABCD"
      },
      "Age": {
        "N": "10"
      }
    }
英文:

I'm trying to migrate the data from one dynamodb table which contains two columns(country, isMinor) as empty for few items to another dynamodb table.

But after migration it puts null values in target dynamodb table for these two missing columns

Is there any way this is possible. Appreciate quick help on this.

Thanks in advance.

e.g. In source table:

 item1 = {
      "Name": {
        "S": "ABCD"
      },
      "Age": {
        "N": "10"
      }
    }
item2 = {
      "Name": {
        "S": "DEFG"
      },
      "Country": {
        "S": "XYZ"
      },
      "isMinor": {
        "BOOL": true
      },
      "Age": {
        "N": "11"
      }
    }

After migration it shows item1 as:

 item1 = {
  "Name": {
    "S": "ABCD"
  },
  "Country": {
    "NULL": true
  },
  "isMinor": {
    "NULL": true
  },
  "Age": {
    "N": "11"
  }

But the expectation after migration in target dynamodb table is as below(same as the item in the source table):

item1 = {
  "Name": {
    "S": "ABCD"
  },
  "Age": {
    "N": "10"
  }
}

答案1

得分: 1

很遗憾,这就是Glue将数据写入DynamoDB的方式,因为Glue需要一个结构化模式。

根据您的迁移类型,如果您不需要对数据进行转换,您可以考虑使用以下选项:

英文:

Unfortunately this is how Glue will write the data to DynamoDB, as Glue expects a structured schema.

Depending on your type of migration, if you do not require transformation of the data you may be able to use

huangapple
  • 本文由 发表于 2023年4月11日 14:49:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75983110.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定