簡體   English   中英

outputLocation不是有效的S3路徑。 雅典娜例外

[英]outputLocation is not a valid S3 path. Athena Exception

我正在嘗試使用C#雅典娜驅動程序執行雅典娜查詢。

Amazon.Athena.Model.ResultConfiguration resultConfig = new Amazon.Athena.Model.ResultConfiguration();
resultConfig.OutputLocation = "https://s3.us-east-2.amazonaws.com/testbucket/one/2018-02-06/";
//other inputs i have tried
//"s3://testbucket/one/2018-02-06/"
//testbucket

//Populate the request object
                Amazon.Athena.Model.StartQueryExecutionRequest queryExec = new Amazon.Athena.Model.StartQueryExecutionRequest();
                queryExec.QueryString = query.QueryString;
                queryExec.QueryExecutionContext = queryExecutionContext;
                queryExec.ResultConfiguration = resultConfig;

StartQueryExecutionResponse athenaResponse = athenaClient.StartQueryExecution(queryExec);//throws exception

不同情況下的例外:

  1. outputLocation不是有效的S3路徑。 提供https://s3.us-east-2.amazonaws.com/testbucket/one/2018-02-06/

  2. 無法驗證/創建輸出存儲桶testbucket。 提供s3:// testbucket / one / 2018-02-06 /

  3. 無法驗證/創建輸出存儲桶testbucket。 提供的測試桶

有人可以為我提供正確的s3格式嗎?

提前致謝。

輸出位置必須采用以下格式:

s3://{bucketname}/{path}

在您的情況下,這將導致以下位置:

resultConfig.OutputLocation = "s3://testbucket/one/2018-02-06/";
Amazon.Athena.AmazonAthenaClient _client = new Amazon.Athena.AmazonAthenaClient(AwsAccessKeyId, AwsSecretAccessKey, EndPoint);
                Amazon.Athena.Model.ResultConfiguration resultConfig = new Amazon.Athena.Model.ResultConfiguration();
                resultConfig.OutputLocation = "s3://"+BucketName+"/key1/";                
                string query = "SELECT * FROM copalanadev.logs";
                //Populate the request object
                Amazon.Athena.Model.StartQueryExecutionRequest queryExec = new Amazon.Athena.Model.StartQueryExecutionRequest();
                queryExec.QueryString = query;
                //queryExec.QueryExecutionContext = queryExecutionContext;
                queryExec.ResultConfiguration = resultConfig;

            StartQueryExecutionResponse athenaResponse = _client.StartQueryExecution(queryExec);//throws exception

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM