Kapil
Kapil

Reputation: 313

Is there any way to specify Prefixes in AWS Athena S3 paths?

I am trying to use Amazon Athena over S3 bucket which has two kinds of files.

a.file.txt b.file.txt

I just want athena to target a.file.txt. Is it possible to specify it in console while creation of table?

Thanks

Upvotes: 4

Views: 2833

Answers (1)

jens walter
jens walter

Reputation: 14039

Creating tables for single files is not supported by Athena. You can only create a table on a directory level.

What is possible on the other hand is, creating a table on the directory level and filter the input file while querying.

You can filter the input file with the $path pseudo column.

select * from tablename
where "$path" = 's3://bucketname/directory/a.file.txt'

Upvotes: 5

Related Questions