Reputation: 1433
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
Upvotes: 3
Views: 3261
Reputation: 2691
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
Upvotes: 3
Reputation: 1433
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']
Upvotes: 6