Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

set the region of dynamoDB explicitly #3

Merged

Conversation

michi88
Copy link
Contributor

@michi88 michi88 commented Dec 11, 2017

as decribed here: #2

It seems we need to set the region for the dynamo db client explicitly when we're using eu-west-1 for example.

I'm no Java expert so if you want to do this differently or you think this should not be needed please let me know how it should work otherwise.

Thanks!

@michi88
Copy link
Contributor Author

michi88 commented Dec 22, 2017

After upgrading the Athena driver to AthenaJDBC41-1.1.0 the following error was fixed:

An error occurred while adding partitions.: java.lang.IllegalStateException
java.lang.IllegalStateException: An error occurred while adding partitions.
at com.amazonaws.services.lambda.model.TableService.addPartitions(TableService.java:58)
at com.amazonaws.services.lambda.CreateAthenaPartitionsBasedOnS3EventWithDDB.handleRequest(CreateAthenaPartitionsBasedOnS3EventWithDDB.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Caused by: java.sql.SQLException: Failed to run query
at com.amazonaws.athena.jdbc.AthenaStatement.execute(AthenaStatement.java:215)
at com.amazonaws.services.lambda.model.TableService.addPartitions(TableService.java:54)
... 5 more
Caused by: com.amazonaws.athena.jdbc.shaded.com.amazonaws.services.athena.model.AmazonAthenaException: No Such Method (Service: AmazonAthena; Status Code: 400; Error Code: UnknownOperationException; Request ID: 68b9ebe4-dd70-11e7-9a8f-85e1113934c9)

This is the query that the function is executing:

ALTER TABLE sampledb.cf_logs ADD IF NOT EXISTS PARTITION (Year='2017',Month='12',Day='10',Hour='06') LOCATION 's3://bucket/2017/12/10/06/'

@infa-rasrinivasan infa-rasrinivasan merged commit 55c137d into amazon-archives:master Oct 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants