Business intelligence made simple
Better error messages for Athena
Andrew Kane3f7378835264
diff --git a/lib/blazer/adapters/athena_adapter.rb b/lib/blazer/adapters/athena_adapter.rbindex fe9ae894..12a85f6a 100644--- a/lib/blazer/adapters/athena_adapter.rb+++ b/lib/blazer/adapters/athena_adapter.rb@@ -78,16 +78,15 @@ module Blazerendendelsif resp- # failed, get message- resp2 = client.get_query_execution(- query_execution_id: query_execution_id- )- error = resp2.query_execution.status.state_change_reason+ error = fetch_error(query_execution_id)elseerror = Blazer::TIMEOUT_MESSAGEendrescue Aws::Athena::Errors::InvalidRequestException => eerror = e.message+ if error == "Query did not finish successfully. Final query state: FAILED"+ error = fetch_error(query_execution_id)+ endend[columns, rows, error]@@ -111,6 +110,12 @@ module Blazer@database ||= settings["database"] || "default"end+ def fetch_error(query_execution_id)+ client.get_query_execution(+ query_execution_id: query_execution_id+ ).query_execution.status.state_change_reason+ end+def client@client ||= Aws::Athena::Client.newend