swa 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 515c45df8339e1e9c4168bc6ab96311385a0dcdac85e65d3425311c859ffef95
4
- data.tar.gz: 827af0b7cd21516b46fa4f06eb751e934e752e4becd071aa1d750ce54244ba4d
3
+ metadata.gz: 6d195d1632c4f915a413f9a7b4f40127eff5497a45b6217159147a392ec4089d
4
+ data.tar.gz: 40720608d5be447d93641459922835fa71d4b698c9d1270eb25d8322db9c87fa
5
5
  SHA512:
6
- metadata.gz: e2d5ca76c3a0acd50514e778d89da6992b7b217a23b69e19e8c6c74ed8b0c0987d3417d93376905b49446c581c1ca6d5a4aaaa221319b82057735f9cba81d76b
7
- data.tar.gz: 4c6a89e273eac6ad8be3092292710ddafda571c70cc78ff0ed39f938bf212f80c4a9d1d7af142b2afbdc26da99b77ff3d1c717a7c55c38be57f45ac7f8d8a766
6
+ metadata.gz: 0a7a37485d2d422b1cf1625f8359ea33a798b450d55c2c4b539995ce302f305340a6893344db6de7c5a8ffcf26224d30b468fe92a7fc7a3638e55f9f476877b4
7
+ data.tar.gz: 157497f4a9da0f7361a2db3435855cdd40ed9aed25c2cae91f9648c34c3bb4577dcb745bce30b3f9c3410fa06efe81d44126540f8de85b1ab1653dd080302802
@@ -91,24 +91,25 @@ module Swa
91
91
 
92
92
  end
93
93
 
94
- subcommand ["executions", "query-executions"], "List query executions" do
94
+ subcommand ["query", "q", "execute", "exec"], "Run a query" do
95
95
 
96
- include CollectionBehaviour
96
+ option ["--database", "-D"], "NAME", "Database name"
97
+ option ["--output-location", "-O"], "S3_URL", "S3 output location for query results"
97
98
 
98
- private
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(query_string: query, work_group: workgroup)
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
@@ -1,3 +1,3 @@
1
1
  module Swa
2
- VERSION = "0.7.6"
2
+ VERSION = "0.7.7"
3
3
  end
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.6
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-16 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler