动态框架写入额外列

Eum*_*coz 5 amazon-redshift pyspark aws-glue

我有一个胶水任务,它从 S3 读取数据,对数据运行几个 SQL 查询,然后将数据输出到 Redshift。我遇到一个奇怪的问题,当写入dynamic_frameRedshift(使用glueContext.write_dynamic_frame.from_options)时,正在创建新列。这些是我现有的一些列,类型附加在末尾。例如,如果我的框架架构如下:

id: string
value: short
value2: long
ts: timestamp
Run Code Online (Sandbox Code Playgroud)

在 Redshift 中我看到:

id varchar(256)
value: smallint    <---- The data here is always null
value2: bigint     <---- The data here is always null
ts: timestamp      
value_short: smallint
value2_long: bigint
Run Code Online (Sandbox Code Playgroud)

和 列在执行时创建(当前使用具有权限的信用进行value_short测试)value2_longalter table

当查看COPY运行的命令时,我看到命令中的列value_short和。value2_long在写入之前,我没有看到动态框架中存在的列glueContext.write_dynamic_frame.from_options

alo*_*ola 2

技巧是将短值转换为整数。Long -> bigint 似乎对我有用。