Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to set ExpressionAttributeNames in tDynamodbinput ?

Hi,

Does anyone know how to set the ExpressionAttributeNames in tDynamodbinput component? One of my dynamodb table is using "date" as sort key column...

and I hit this error when using name mapping:

Exception in component tDynamoDBInput_2 (data_repatch_sum_trip_dynamodb)
com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException: ExpressionAttributeNames contains invalid key: Syntax error; key: "date" (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: PB5QJ1AU7EV9P84611N9H6U3DVVV4KQNSO5AEMVJF66Q9ASUAAJG)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1658)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1322)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1072)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:745)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:719)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:701)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:669)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:651)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:515)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:3768)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:3737)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.executeQuery(AmazonDynamoDBClient.java:2550)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.query(AmazonDynamoDBClient.java:2518)
at com.amazonaws.services.dynamodbv2.document.internal.QueryCollection.firstPage(QueryCollection.java:53)
at com.amazonaws.services.dynamodbv2.document.internal.PageIterator.next(PageIterator.java:45)
at com.amazonaws.services.dynamodbv2.document.internal.IteratorSupport.nextResource(IteratorSupport.java:87)
at com.amazonaws.services.dynamodbv2.document.internal.IteratorSupport.hasNext(IteratorSupport.java:55)
at gittalend_etlv4.data_repatch_sum_trip_dynamodb_0_1.data_repatch_sum_trip_dynamodb.tDynamoDBInput_2Process(data_repatch_sum_trip_dynamodb.java:1648)
at gittalend_etlv4.data_repatch_sum_trip_dynamodb_0_1.data_repatch_sum_trip_dynamodb.tFileInputExcel_1Process(data_repatch_sum_trip_dynamodb.java:1238)
at gittalend_etlv4.data_repatch_sum_trip_dynamodb_0_1.data_repatch_sum_trip_dynamodb.runJobInTOS(data_repatch_sum_trip_dynamodb.java:2063)
at gittalend_etlv4.data_repatch_sum_trip_dynamodb_0_1.data_repatch_sum_trip_dynamodb.main(data_repatch_sum_trip_dynamodb.java:1912)

 

 

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks for your answer, For your answer will be suitable for those using relational Database like Mysql, MSSQL, Postgresql and etc. However, DynamoDb is a NoSQL which the query is written in JSON object like this link:

https://qiita.com/ekzemplaro/items/f8b7e31d98ee089443f3

 

Btw I found out the way to put those ExpressionAttributeNames already, so I would put my solution here so that in future someone might nid this solution again haha.

The way that I solve this problem is instead of using basic key condition like the image I upload in my 1st post. Try to use "Use advanced key condition expression", to allow write your own key condition expression, then use Value Mapping as ExpressionAttributeValues and Name Mapping as ExpressionAttributeNames to replace those reserved words that use by AWS dynamoDb.



solution.png

View solution in original post

5 Replies
nfz11
Creator III
Creator III

Did you try putting a Date variable in Value 1 and 2 instead of a String?

 

TalendDate.parseDate("2019-05-22","yyyy-MM-dd")
Anonymous
Not applicable
Author

Thanks for the reply,

But dynamoDb does not support date type, and I'm using String to store the date in this table, and the current system is using it. but when I want to query record out from Talend it hit error which date is reserved word. So I want to use the Expression Attribute Names that AWS provided to replace the "date", but it seems like not work when I using name mapping that provides by the tdynamoDbinput component...

nfz11
Creator III
Creator III

Can you alias the date column in your query?  I don't know DynamoDb but in SQL it would be:

 

select date as my_date

Also, did you try something other than #date, like #my_date? 

Anonymous
Not applicable
Author

Thanks for your answer, For your answer will be suitable for those using relational Database like Mysql, MSSQL, Postgresql and etc. However, DynamoDb is a NoSQL which the query is written in JSON object like this link:

https://qiita.com/ekzemplaro/items/f8b7e31d98ee089443f3

 

Btw I found out the way to put those ExpressionAttributeNames already, so I would put my solution here so that in future someone might nid this solution again haha.

The way that I solve this problem is instead of using basic key condition like the image I upload in my 1st post. Try to use "Use advanced key condition expression", to allow write your own key condition expression, then use Value Mapping as ExpressionAttributeValues and Name Mapping as ExpressionAttributeNames to replace those reserved words that use by AWS dynamoDb.



solution.png
nfz11
Creator III
Creator III

OK I am glad you solved it.  Please mark your reply as the solution.