Skip to content

Commit

Permalink
Prepare for ReqAthena v0.2 (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
philss authored Sep 14, 2024
1 parent 6b5cfa4 commit 996b26b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
12 changes: 10 additions & 2 deletions lib/kino_db/connection_cell.ex
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ defmodule KinoDB.ConnectionCell do
unquote(quoted_var(attrs["variable"])) =
Req.new(http_errors: :raise)
|> ReqAthena.attach(
format: :explorer,
access_key_id: unquote(attrs["access_key_id"]),
database: unquote(attrs["database"]),
output_location: unquote(attrs["output_location"]),
Expand Down Expand Up @@ -465,8 +466,15 @@ defmodule KinoDB.ConnectionCell do
end

defp missing_dep(%{"type" => "athena"}) do
unless Code.ensure_loaded?(ReqAthena) do
~s|{:req_athena, "~> 0.1"}|
deps = [
{ReqAthena, ~s|{:req_athena, "~> 0.1"}|},
{Explorer, ~s|{:explorer, "~> 0.9"}|}
]

deps = for {module, dep} <- deps, not Code.ensure_loaded?(module), do: dep

if deps != [] do
Enum.join(deps, ", ")
end
end

Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ defmodule KinoDB.MixProject do
{:tds, "~> 2.3.4 or ~> 2.4", optional: true},

# Those dependecies are new, so we use stricter versions
{:explorer, "~> 0.7.0 or ~> 0.8.0", optional: true},
{:explorer, "~> 0.8.0 or ~> 0.9.0", optional: true},
{:req_bigquery, "~> 0.1.0", optional: true},
{:req_athena, "~> 0.1.1", optional: true},
{:req_athena, "~> 0.2.0", optional: true},

# Dev only
{:ex_doc, "~> 0.28", only: :dev, runtime: false}
Expand Down
Loading

0 comments on commit 996b26b

Please sign in to comment.