Skip to content

Amazon Athena SDK and CLI do not return S3Tables catalogs in list-catalogs calls

0

My account has the S3Tables analytics service integration enabled. I am using the Grafana plugin athena-data-source to query Amazon Athena, which is currently not able to use s3tables catalogs, because they are not returned by Athena service, even though they are shown in the AWS Athena console screen.

Grafana's athena-datasource plugin uses the Amazon Athena API to query for catalogs, databases and tables. In my case, I have a S3Tables Table Bucket named hello-world. When I call a CLI command such as

aws athena list-data-catalogs

I expect it to return a catalog with name of s3tablescatalog/hello-world but it does not. When I call a command such as

aws athena list-databases --catalog-name s3tablescatalog/hello-world

It correctly lists the databases (s3tables namespaces) for my table bucket. Similarly, calling

aws athena list-table-metadata --catalog-name s3tablescatalog/hello-world --database-name mynamespace

will correctly list the tables in my database (s3tables namespace). When analysing the s3tablescatalog from glue

aws glue get-catalogs

It returns

{
    "CatalogList": [
        {
            "CatalogId": "<accountid>:s3tablescatalog",
            "Name": "s3tablescatalog",
            "ResourceArn": "arn:aws:glue:<region>:<accountid>:catalog/s3tablescatalog",
            "CreateTime": "2025-08-02T20:24:51+08:00",
            "FederatedCatalog": {
                "Identifier": "arn:aws:s3tables:<region>:<accountid>:bucket/*",
                "ConnectionName": "aws:s3tables",
                "ConnectionType": "aws:s3tables"
            },
            "CatalogProperties": {},
            "CreateTableDefaultPermissions": [],
            "CreateDatabaseDefaultPermissions": [],
            "AllowFullTableExternalDataAccess": "True"
        }
    ]
}

Why does Athena not list s3tables catalogs using the API, when the same API is able to list databases and tables, when a (federated) s3tables catalog name is provided?

asked a year ago473 views

2 Answers
0

The current workaround is to register a new Athena Catalog (type = GLUE) that explictly references your S3Tables Table Bucket. It is detailed in part here - https://docs.aws.amazon.com/athena/latest/ug/gdc-register-s3-table-bucket-cat.html#gdc-register-s3-table-console-steps

I have written about this issue in more detail here - https://www.tind.au/blog/access-s3tables-with-grafana-and-athena/

answered a year ago

-1

The issue you're experiencing with S3Tables catalogs not appearing in the list-data-catalogs API call is related to how S3 Tables integrate with AWS analytics services.

When you use the aws athena list-data-catalogs command, it only returns the data catalogs that are directly registered with Athena in your current AWS account. These typically include the default AWS Glue Data Catalog (shown as "AwsDataCatalog") and any Lambda-based federated catalogs you might have set up.

S3 Tables use a separate catalog system that integrates with AWS Lake Formation for access control. The S3 Tables catalogs follow a specific naming convention (s3tablescatalog/bucket-name), and while they're accessible through Athena, they aren't returned by the standard list-data-catalogs API call.

This explains why you can successfully query the S3 Tables catalog when you explicitly provide the catalog name in commands like list-databases and list-table-metadata, but the catalog itself doesn't appear in the list of catalogs.

The AWS Athena console is likely using additional internal mechanisms to display S3 Tables catalogs that aren't exposed through the public API. This creates a discrepancy between what you see in the console versus what's returned by the API calls.

For tools like the Grafana athena-datasource plugin that rely on the list-data-catalogs API, this presents a limitation when working with S3 Tables. You would need to either modify the plugin to explicitly include your known S3 Tables catalogs or request an enhancement to the Athena API to include S3 Tables catalogs in the response.
Sources
Athena examples using AWS CLI - AWS SDK Code Examples
S3 Tables - Unable to query using Athena | AWS re:Post
list-data-catalogs — AWS CLI 2.27.41 Command Reference

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.