With reference to the below post,
How to get input file name as column in AWS Athena external tables
I tried running the query using the aws athena cli command as below,
aws athena start-query-execution --query-string "SELECT regexp_extract(\
"$path\", '[^/]+$') AS filename FROM table" --query-execution-context '{"Database": "testdatabase"}' --result-configuration '{ "OutputLocation": "s3://<somevalidbucket>"}'
I always get the query executed with empty value for $path. e.g., "SELECT regexp_extract('', '[^/]+$') AS filename ...." and filename appears as empty in all the returned rows.
Note: I replaced double quotes with single quotes around $path and the result did not change.
Same query works fine on AWS console though. What am I missing here?