AWS Glue Job How to Load MySQL unsigned integer into Redshift

0

I'm using AWS Glue to load data from MySQL to Redshift and encountering some issues. When the MySQL column type is numeric, it loads as NULL in the corresponding Redshift table.

For columns in MySQL with the type Decimal(N,0), I was able to resolve the issue by setting the corresponding Redshift column type to bigint. However, I have not found a solution yet for columns in MySQL with the type unsigned int.

Requesting: How to set Redshift column types for these columns? How to set the Glue Job script?

Aaren
질문됨 일 년 전281회 조회
1개 답변
0

https://stackoverflow.com/questions/54468084/aws-glue-not-copying-idint-column-to-redshift-its-blank

When AWS Glue crawls a column, it might not decide on a definitive type for that column. Instead, it maintains a 'type choice' where the exact type of a crawled column can remain as a number of possibilities throughout the ETL Job. The crawler only crawls a subset of a column's data to determine the probable type. This is why when you run the job or look at a preview, the type of the column might get resolved to a type that is incompatible with the dataset, which results in empty data for the column in question​.

The solution is to add into your script an explicit resolution of the choices, by casting the column that's failing to the desired target type. Here is how you can do it:

df.resolveChoice(specs = [('id', 'cast:int')])

profile picture
전문가
답변함 일 년 전
  • I used Visual GUI create job, the script code no variable df

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인