Glue: Get Sink- Error "unsupported operand type(s) for +: 'JavaMember' and 'str'"

1

Hello Members, Please help with below issue, I am not able to find in documentation

I am trying below :


silver_target = glueContext.getSink( path='s3://bucketpath', connection_type="s3", updateBehavior='UPDATE_IN_DATABASE', partitionKeys=["pyear"], enableUpdateCatalog=True, transformation_ctx="silver_target", )

silver_target.setCatalogInfo( catalogDatabase=gluecatalogdb, catalogTableName=tableName ) silver_target.setFormat("glueparquet") silver_target.writeFrame(newdf)


newdf is : dataframe for existing data + new incremental data so I tired : appended_df=existing_df.union(newincremental_df) newdf=appended_df.repartition(1)


After executing this I am getting error as TypeError: unsupported operand type(s) for +: 'JavaMember' and 'str'


I check the schema, count I see everything is matching , not sure what is going on in backend

Please help. Thanks

  • Can you please share the rest of the code ? This sounds like a problem in pure python code.

已提問 8 個月前檢視次數 330 次
2 個答案
0
已接受的答案

Hi @rePost-User-5744318,

Could you please try to convert the glue dynamic frame to spark data frame, and apply union transformation. It may give some better error logs, so that further troubleshooting can be performed. Thank you :)

已回答 8 個月前
  • Once I converted the dynamic frame to DF, union worked as expected, thank you

  • I am facing similar issue, you can read any two dynamicFrames and apply union and then do a map/filter it would give you an error that javamember' object has no attribute '_get_object_id'.

    Converting to DataFrame and doing union works but that is not a solution for those who do not want the conversion overhead.

0

That's not a really a data error, that's sounds like API usage error or some print statement that is trying to concatenate.
The stacktrace should tell you the line/API that is not used correctly

profile pictureAWS
專家
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南