Skip to content

Getting error while querying DynamoDB in Athena using Glue Crawler

0

Hi,

I've created a crawler in Glue to query DDB in Athena. The crawler succeeded on it's run and the table is visible in Data Catalogue with the correct schema and correct record count. However, I don't see this table in my athena query editor and when trying to run the following query

SELECT * FROM "ws-02qr-micro_market_data_lake-dev"."test-1ws_02qr_stock_movements_dev" limit 10;

I get the following error

HIVE_UNKNOWN_ERROR: java.net.URISyntaxException: Relative path in absolute URI: arn:aws:dynamodb:eu-west-1:xx:table/ws-02qr-stock-movements-dev

The table test-1ws_02qr_stock_movements_dev is visible in AWS Glue Tables with location as arn:aws:dynamodb:eu-west-1:xx:table/ws-02qr-stock-movements-dev

Am I missing any step or is the SQL query incorrect?

2 Answers
1

It seems like you are trying to query DynamoDB directly from Athena, but you must have the Athena-DynamoDB connector in place before you can do that, as discussed in this answer: https://repost.aws/questions/QU_iNc9D56SQC_8N30bMVUOQ/hive-unknown-error-java-net-urisyntaxexception-relative-path-in-absolute-uri-arn-aws-dynamodb-us-east-1-account-id-table-mytable#ANxOWaMnlHTE-1woUY1lOjCA

Keep in mind, Athena queries coming through the connector will consume read capacity units on the table, which could possibly impact your production traffic.

You could also use (Do not consume capacity from DynamoDB):

  1. DynamoDB Zero ETL to SageMaker LakeHouse which will sync your data in parquet files on S3, which would be an excellent fit for Athena
  2. Should it be a one time job, or the staleness of the data doesn't matter you can Export your DynamoDB data to S3, allowing you to again Query directly from Athena.
AWS
EXPERT
answered a year ago
EXPERT
reviewed a year ago
0
To query DynamoDB tables using Athena, you need to use the Athena DynamoDB connector, which isn't automatically set up when you create a Glue crawler for a DynamoDB table.

The error you're seeing occurs because Athena is trying to interpret the DynamoDB ARN as a file path, which it cannot process directly. Standard Glue crawlers can catalog DynamoDB tables, but Athena needs a special connector to query them.

Here's what you need to do:

1. Deploy the Athena DynamoDB connector from the AWS Serverless Application Repository. This connector uses a Lambda function to query data in DynamoDB.

2. After deploying the connector, create a data source in Athena that points to your DynamoDB table.

3. Make sure the Lambda function and Athena spill bucket are in the same AWS region.

4. Ensure your Query Result Location is properly set in Athena.

5. Once the connector is set up, you'll need to query using the data source name you created, not directly against the Glue database table.

The connector has some limitations with schema inference, so you might need to edit the table properties in AWS Glue to properly enable them for use with DynamoDB. This includes adding the "dynamodb" string to the table properties under the "classification" field and specifying the source table name.

Remember that the Athena DynamoDB connector only recognizes lowercase table and column names when migrated to Glue Catalog.
  

Sources
HIVE_UNKNOWN_ERROR: java.net.URISyntaxException: Relative path in absolute URI: arn:aws:dynamodb:us-east-1:<account-id>:table/mytable | AWS re:Post
Query Amazon DynamoDB tables with SQL by using Amazon Athena - AWS Prescriptive Guidance
Amazon Athena DynamoDB connector - Amazon Athena

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.