swa 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/swa/cli/athena_command.rb +19 -14
- data/lib/swa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d195d1632c4f915a413f9a7b4f40127eff5497a45b6217159147a392ec4089d
|
4
|
+
data.tar.gz: 40720608d5be447d93641459922835fa71d4b698c9d1270eb25d8322db9c87fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a7a37485d2d422b1cf1625f8359ea33a798b450d55c2c4b539995ce302f305340a6893344db6de7c5a8ffcf26224d30b468fe92a7fc7a3638e55f9f476877b4
|
7
|
+
data.tar.gz: 157497f4a9da0f7361a2db3435855cdd40ed9aed25c2cae91f9648c34c3bb4577dcb745bce30b3f9c3410fa06efe81d44126540f8de85b1ab1653dd080302802
|
@@ -91,24 +91,25 @@ module Swa
|
|
91
91
|
|
92
92
|
end
|
93
93
|
|
94
|
-
subcommand ["
|
94
|
+
subcommand ["query", "q", "execute", "exec"], "Run a query" do
|
95
95
|
|
96
|
-
|
96
|
+
option ["--database", "-D"], "NAME", "Database name"
|
97
|
+
option ["--output-location", "-O"], "S3_URL", "S3 output location for query results"
|
97
98
|
|
98
|
-
|
99
|
-
|
100
|
-
def collection
|
101
|
-
query_for(:list_query_executions, :query_execution_ids, Swa::Athena::QueryExecution, work_group: workgroup)
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
subcommand ["query", "q", "run"], "Run a query" do
|
107
|
-
|
108
|
-
parameter "QUERY", "SQL query"
|
99
|
+
parameter "[QUERY]", "SQL query", :default => "STDIN"
|
109
100
|
|
110
101
|
def execute
|
111
|
-
start_query_response = athena_client.start_query_execution(
|
102
|
+
start_query_response = athena_client.start_query_execution(
|
103
|
+
query_execution_context: {
|
104
|
+
catalog: catalog,
|
105
|
+
database: database
|
106
|
+
},
|
107
|
+
query_string: query,
|
108
|
+
result_configuration: {
|
109
|
+
output_location: output_location
|
110
|
+
},
|
111
|
+
work_group: workgroup
|
112
|
+
)
|
112
113
|
wait_for_query(start_query_response.query_execution_id)
|
113
114
|
query_results = athena_client.get_query_results(query_execution_id: start_query_response.query_execution_id)
|
114
115
|
output_results_as_csv(query_results.result_set)
|
@@ -116,6 +117,10 @@ module Swa
|
|
116
117
|
|
117
118
|
private
|
118
119
|
|
120
|
+
def default_query
|
121
|
+
$stdin.read
|
122
|
+
end
|
123
|
+
|
119
124
|
def wait_for_query(query_execution_id)
|
120
125
|
QueryCompletionWaiter.new(client: athena_client).wait(query_execution_id: query_execution_id)
|
121
126
|
rescue Aws::Waiters::Errors::FailureStateError => error
|
data/lib/swa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|