0
votes

Anybody know how (Athena w Glue) to return the full s3:// address of a table whose table name I know. Something like:

SELECT location FOR TABLE xyz;

Seems simple enough but I can't find it

2
did you add partition metascore ? command like MSCK REPAIR TABLE test;GNOKOHEAT

2 Answers

3
votes

Found a way using boto3 (Python library for AWS)

import boto3

client = boto3.client('glue')
tbl_data = client.get_table(DatabaseName='<database_name>', Name='xyz')

tbl_data['Table']['StorageDescriptor']['Location']
3
votes

Also possible to get the location via aws cli command:

aws glue get-table --database-name bigdata --name test --query "Table.StorageDescriptor.Location"

output: "s3://bucket_name/big_data/test/"

Following gives all the details of a table.

aws glue get-table --database-name bigdata --name test

To get the location, access it via Table.StorageDescriptor.Location