Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/req_athena.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule ReqAthena do
workgroup
region
database
catalog
athena
output_location
cache_query
Expand Down Expand Up @@ -265,7 +266,10 @@ defmodule ReqAthena do

body =
Map.merge(output_config, %{
QueryExecutionContext: %{Database: Request.fetch_option!(request, :database)},
QueryExecutionContext: %{
Database: Request.fetch_option!(request, :database),
Catalog: Request.get_option(request, :catalog)
Comment thread
isubasti marked this conversation as resolved.
},
QueryString: ReqAthena.Query.to_query_string(query)
})

Expand Down
7 changes: 6 additions & 1 deletion test/req_athena_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
~s|{"ResultSet":{"ColumnInfos":[{"CaseSensitive":false,"CatalogName":"hive","Label":"id","Name":"id","Nullable":"UNKNOWN","Precision":10,"Scale":0,"SchemaName":"","TableName":"","Type":"integer"},{"CaseSensitive":true,"CatalogName":"hive","Label":"name","Name":"name","Nullable":"UNKNOWN","Precision":2147483647,"Scale":0,"SchemaName":"","TableName":"","Type":"varchar"}],"ResultRows":[{"Data":["id","name"]},{"Data":["1","Ale"]},{"Data":["2","Wojtek"]}],"ResultSetMetadata":{"ColumnInfo":[{"CaseSensitive":false,"CatalogName":"hive","Label":"id","Name":"id","Nullable":"UNKNOWN","Precision":10,"Scale":0,"SchemaName":"","TableName":"","Type":"integer"},{"CaseSensitive":true,"CatalogName":"hive","Label":"name","Name":"name","Nullable":"UNKNOWN","Precision":2147483647,"Scale":0,"SchemaName":"","TableName":"","Type":"varchar"}]},"Rows":[{"Data":[{"VarCharValue":"id"},{"VarCharValue":"name"}]},{"Data":[{"VarCharValue":"1"},{"VarCharValue":"Ale"}]},{"Data":[{"VarCharValue":"2"},{"VarCharValue":"Wojtek"}]}]},"UpdateCount":0}|
end

test "executes a parameterized query" do

Check failure on line 152 in test/req_athena_test.exs

View workflow job for this annotation

GitHub Actions / test (27.0, 1.17.2, lint)

test executes a parameterized query (ReqAthenaTest)

Check failure on line 152 in test/req_athena_test.exs

View workflow job for this annotation

GitHub Actions / test (25.0, 1.14.2)

test executes a parameterized query (ReqAthenaTest)
validations = %{
"StartQueryExecution" => fn request ->
if Req.Request.get_private(request, :athena_query_execution_id, nil) do
Expand All @@ -164,6 +164,7 @@
assert %{
"ClientRequestToken" => ^client_req_token,
"QueryExecutionContext" => %{
"Catalog" => nil,
"Database" => "my_awesome_database"
},
"QueryString" => "EXECUTE query_8CD6B60FAFA18EBFA8719A6EAC192624 USING 1",
Expand All @@ -181,6 +182,7 @@
assert %{
"ClientRequestToken" => ^client_req_token,
"QueryExecutionContext" => %{
"Catalog" => nil,
"Database" => "my_awesome_database"
},
"QueryString" =>
Expand Down Expand Up @@ -331,7 +333,7 @@
assert_received :token_validation
end

test "executes a query with workgroup" do

Check failure on line 336 in test/req_athena_test.exs

View workflow job for this annotation

GitHub Actions / test (27.0, 1.17.2, lint)

test executes a query with workgroup (ReqAthenaTest)

Check failure on line 336 in test/req_athena_test.exs

View workflow job for this annotation

GitHub Actions / test (25.0, 1.14.2)

test executes a query with workgroup (ReqAthenaTest)
me = self()

validations = %{
Expand All @@ -346,7 +348,10 @@

assert %{
"ClientRequestToken" => ^client_req_token,
"QueryExecutionContext" => %{"Database" => "my_awesome_database"},
"QueryExecutionContext" => %{
"Catalog" => nil,
"Database" => "my_awesome_database"
},
"QueryString" => "select * from iris",
"WorkGroup" => "default"
} = decoded
Expand Down
Loading