Skip to content

Unable to query metadata on table asset after export metadata by AWS CLI

0

Hello, I export table's metadata by use below command:

aws datazone put-data-export-configuration --domain-identifier dzd-abc --enable-export --region ap-southeast-1 --profile POC-AWS-PROFILE

I have tried to query metadata in Data Explorer in Amazon SageMaker Unified Studio by use below query:

select * from "s3tablescatalog/aws-sagemaker-catalog"."asset_metadata"."asset"

But received error message: "Insufficient permissions to execute the query. Principal does not have any privilege on specified resource".

I go to Lake Formation, and checked s3tablescatalog, it's type is Federated and Source is S3 and no objects inside this catalog. But still see database **asset_metadata **and one table with name asset

So when I trying to grant permissions on s3tablescatalog, the below error message appear:

Grant permissions failed
Error granting catalog permissions to ARNs: arn:aws:iam::<MY ACCOUNT ID>:role/<Project role ARN>. Unexpected error has occurred trying to grant permissions. Resource does not exist or requester is not authorized to access requested permissions.

It's so strange because in Data Explorer in Amazon SageMaker Unified Studio, I see inside s3tablescatalog, there is nested catalog with name aws-sagemaker-catalog. But I can not find this catalog in AWS.

I accessing to SageMaker Unified Studio by using SSO. Also added policies to Project role ARN { "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Action": [ "sagemaker:", "glue:GetCatalog", "glue:GetDatabase", "glue:GetTable", "glue:GetTables", "athena:StartQueryExecution", "athena:GetQueryResults", "s3tables:" ], "Resource": "*" } ] } But unable to query data from table asset.

Thank you.

asked 10 months ago143 views

2 Answers
0

It looks like you're experiencing permission issues when trying to query the SageMaker Catalog exported metadata. The error "Insufficient permissions to execute the query" indicates that your role doesn't have the necessary Lake Formation permissions to access the asset table.

To resolve this issue, you need to:

  1. Make sure you've enabled analytic services integration for S3 Tables.

  2. Grant the appropriate Lake Formation permissions to your role. The correct format for granting permissions to the SageMaker Catalog asset table is:

aws lakeformation grant-permissions \
--principal DataLakePrincipalIdentifier=arn:aws:iam::<YOUR-ACCOUNT-ID>:role/<YOUR-ROLE> \
--resource '{"Table": {"CatalogId": "<YOUR-ACCOUNT-ID>:s3tablescatalog/aws-sagemaker-catalog", "DatabaseName": "asset_metadata", "Name": "asset"}}' \
--permissions DESCRIBE SELECT \
--region ap-southeast-1

Note that the CatalogId should include your account ID followed by :s3tablescatalog/aws-sagemaker-catalog. This is important because the catalog is a nested catalog within s3tablescatalog.

The error you're seeing when trying to grant permissions directly on s3tablescatalog is because you need to specify the full path to the nested catalog (aws-sagemaker-catalog) as shown in the command above.

Also, ensure that your IAM role has the necessary permissions for Lake Formation operations. You may need to add lakeformation:GrantPermissions and other Lake Formation permissions to your policy.
Sources
Exporting asset metadata - Amazon SageMaker Unified Studio
Querying metadata tables with AWS analytics services - Amazon Simple Storage Service
Troubleshooting S3 Metadata - Amazon Simple Storage Service

answered 10 months ago

0

Hello,

For "Make sure you've enabled analytic services integration for S3 Tables.", it's completed. But after ran command "aws lakeformation grant-permissions", received error message "An error occurred (InvalidInputException) when calling the GrantPermissions operation: Table not found."

Any ideas on this?

Thank you

answered 10 months 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.