如何在 Glue python 作业脚本中表示类型编号的排序键
How to represent a sort key of type number in a Glue python job script
我想使用 AWS Glue 将该数据导入 dynamoDB table,分区键 'classId'(字符串)和排序键 'itemId'(数字)
谁能告诉我如何在我使用的 Glue 作业脚本中表示排序键
当我做的时候
# Map the source field names and data types to target values. The target values should be exactly the
# same as the source DyanmoDB table values
Mapped = ApplyMapping.apply(frame = Source, mappings = [
("item.classId.S", "string", "classId", "string"),
("item.itemId.N", "number", "itemId", "number"),
],
transformation_ctx = "Mapped")
我收到错误
非法参数异常:'Invalid type name number'
如果我用
("item.itemId.N", "字符串", "itemId", "字符串"),
我收到错误
提供的关键元素与架构不匹配
如何表示此代码中的排序键?
感谢您的帮助
AWS Glue 使用 Dynamic DataFrame (LINK) by default when you load your data. You could find the list of available data types for the dynamic DataFrame HERE.
使用映射时,您将同时重命名和转换数据类型(源列、源类型、目标列、目标类型)。因此,源和目标中的列类型都很重要。
我想如果你把你的线路改成 ("item.itemId.N", "double", "itemId", "double")
就可以了。
虽然解决了问题,但我认为它遗漏了解释的关键部分:
DataFrame 数据类型与映射中指定的数据类型有何关系?
据我所知,映射中的类型名称只是 Python 数据类型的名称 - 如果您使用 Python.
您可以找到 Python 数据类型与 the Glue (Spark) data types linked by Amir in the Spark docs 之间的关系(向下滚动到选项卡并选择 Python)。
我想使用 AWS Glue 将该数据导入 dynamoDB table,分区键 'classId'(字符串)和排序键 'itemId'(数字)
谁能告诉我如何在我使用的 Glue 作业脚本中表示排序键
当我做的时候
# Map the source field names and data types to target values. The target values should be exactly the
# same as the source DyanmoDB table values
Mapped = ApplyMapping.apply(frame = Source, mappings = [
("item.classId.S", "string", "classId", "string"),
("item.itemId.N", "number", "itemId", "number"),
],
transformation_ctx = "Mapped")
我收到错误 非法参数异常:'Invalid type name number'
如果我用 ("item.itemId.N", "字符串", "itemId", "字符串"),
我收到错误 提供的关键元素与架构不匹配
如何表示此代码中的排序键?
感谢您的帮助
AWS Glue 使用 Dynamic DataFrame (LINK) by default when you load your data. You could find the list of available data types for the dynamic DataFrame HERE.
使用映射时,您将同时重命名和转换数据类型(源列、源类型、目标列、目标类型)。因此,源和目标中的列类型都很重要。
我想如果你把你的线路改成 ("item.itemId.N", "double", "itemId", "double")
就可以了。
虽然
DataFrame 数据类型与映射中指定的数据类型有何关系?
据我所知,映射中的类型名称只是 Python 数据类型的名称 - 如果您使用 Python.
您可以找到 Python 数据类型与 the Glue (Spark) data types linked by Amir in the Spark docs 之间的关系(向下滚动到选项卡并选择 Python)。