athena-cli 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.projections.json +20 -0
- data/.ruby-version +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +75 -0
- data/LICENSE.md +20 -0
- data/README.md +128 -0
- data/Rakefile +44 -0
- data/athena-cli.gemspec +26 -0
- data/bin/athena-cli +10 -0
- data/features/athena.feature +8 -0
- data/features/step_definitions/athena_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/amazon_athena.rb +7 -0
- data/lib/amazon_athena/cli.rb +406 -0
- data/lib/amazon_athena/client.rb +114 -0
- data/lib/amazon_athena/command.rb +16 -0
- data/lib/amazon_athena/commands.rb +20 -0
- data/lib/amazon_athena/commands/alter_table_add_partition.rb +29 -0
- data/lib/amazon_athena/commands/alter_table_drop_partition.rb +29 -0
- data/lib/amazon_athena/commands/create_database.rb +23 -0
- data/lib/amazon_athena/commands/create_table.rb +23 -0
- data/lib/amazon_athena/commands/describe_table.rb +21 -0
- data/lib/amazon_athena/commands/drop_database.rb +23 -0
- data/lib/amazon_athena/commands/drop_table.rb +23 -0
- data/lib/amazon_athena/commands/repair_table.rb +23 -0
- data/lib/amazon_athena/commands/show_columns.rb +22 -0
- data/lib/amazon_athena/commands/show_create_table.rb +22 -0
- data/lib/amazon_athena/commands/show_databases.rb +17 -0
- data/lib/amazon_athena/commands/show_partitions.rb +28 -0
- data/lib/amazon_athena/commands/show_table_properties.rb +36 -0
- data/lib/amazon_athena/commands/show_tables.rb +23 -0
- data/lib/amazon_athena/partition.rb +21 -0
- data/lib/amazon_athena/transformer.rb +19 -0
- data/lib/amazon_athena/version.rb +3 -0
- data/lib/jdbc_helper/athena.rb +38 -0
- data/lib/jdbc_helper/resultset.rb +14 -0
- data/log4j.xml +18 -0
- data/script/bootstrap +5 -0
- data/script/package +8 -0
- data/script/release +16 -0
- data/script/test +6 -0
- data/test/lib/amazon_athena/commands/alter_table_add_partition_test.rb +64 -0
- data/test/lib/amazon_athena/commands/alter_table_drop_partition_test.rb +61 -0
- data/test/lib/amazon_athena/commands/create_database_test.rb +27 -0
- data/test/lib/amazon_athena/commands/describe_table_test.rb +23 -0
- data/test/lib/amazon_athena/commands/drop_database_test.rb +22 -0
- data/test/lib/amazon_athena/commands/drop_table_test.rb +23 -0
- data/test/lib/amazon_athena/commands/repair_table_test.rb +20 -0
- data/test/lib/amazon_athena/commands/show_columns_test.rb +23 -0
- data/test/lib/amazon_athena/commands/show_create_table_test.rb +23 -0
- data/test/lib/amazon_athena/commands/show_databases_test.rb +23 -0
- data/test/lib/amazon_athena/commands/show_partitions_test.rb +23 -0
- data/test/lib/amazon_athena/commands/show_table_properties_test.rb +25 -0
- data/test/lib/amazon_athena/commands/show_tables_test.rb +23 -0
- data/test/test_helper.rb +1 -0
- metadata +185 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/repair_table'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::RepairTable do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::RepairTable.new("mydb.mytable")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "MSCK REPAIR TABLE mydb.mytable;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
conn = MiniTest::Mock.new
|
16
|
+
conn.expect(:query, nil, ["MSCK REPAIR TABLE mydb.mytable;"])
|
17
|
+
|
18
|
+
@cmd.run(conn)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/show_columns'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::ShowColumns do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::ShowColumns.new("mydb.mytable")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "SHOW COLUMNS IN mydb.mytable;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
results = MiniTest::Mock.new
|
16
|
+
results.expect(:map, nil)
|
17
|
+
|
18
|
+
conn = MiniTest::Mock.new
|
19
|
+
conn.expect(:query, results, ["SHOW COLUMNS IN mydb.mytable;"])
|
20
|
+
|
21
|
+
@cmd.run(conn)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/show_create_table'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::ShowCreateTable do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::ShowCreateTable.new("mydb.mytable")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "SHOW CREATE TABLE mydb.mytable;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
results = MiniTest::Mock.new
|
16
|
+
results.expect(:raw_output, nil)
|
17
|
+
|
18
|
+
conn = MiniTest::Mock.new
|
19
|
+
conn.expect(:query, results, ["SHOW CREATE TABLE mydb.mytable;"])
|
20
|
+
|
21
|
+
@cmd.run(conn)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/show_databases'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::ShowDatabases do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::ShowDatabases.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "SHOW DATABASES;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
results = MiniTest::Mock.new
|
16
|
+
results.expect(:map, nil)
|
17
|
+
|
18
|
+
conn = MiniTest::Mock.new
|
19
|
+
conn.expect(:query, results, ["SHOW DATABASES;"])
|
20
|
+
|
21
|
+
@cmd.run(conn)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/show_partitions'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::ShowPartitions do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::ShowPartitions.new("mydb.mytable")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "SHOW PARTITIONS mydb.mytable;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
results = MiniTest::Mock.new
|
16
|
+
results.expect(:raw_output, nil)
|
17
|
+
|
18
|
+
conn = MiniTest::Mock.new
|
19
|
+
conn.expect(:query, results, ["SHOW PARTITIONS mydb.mytable;"])
|
20
|
+
|
21
|
+
@cmd.run(conn)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/show_table_properties'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::ShowTableProperties do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::ShowTableProperties.new("mydb.mytable")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "SHOW TBLPROPERTIES mydb.mytable;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
text = "EXTERNAL\tTRUE\ntransient_lastDdlTime\t1488319092"
|
16
|
+
|
17
|
+
results = MiniTest::Mock.new
|
18
|
+
results.expect(:raw_output, text)
|
19
|
+
|
20
|
+
conn = MiniTest::Mock.new
|
21
|
+
conn.expect(:query, results, ["SHOW TBLPROPERTIES mydb.mytable;"])
|
22
|
+
|
23
|
+
@cmd.run(conn)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/amazon_athena/commands/show_tables'
|
3
|
+
|
4
|
+
describe AmazonAthena::Commands::ShowTables do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = AmazonAthena::Commands::ShowTables.new("mydb")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "provides a db statement" do
|
11
|
+
assert_equal "SHOW TABLES IN mydb;", @cmd.statement
|
12
|
+
end
|
13
|
+
|
14
|
+
it "executes a query" do
|
15
|
+
results = MiniTest::Mock.new
|
16
|
+
results.expect(:map, nil)
|
17
|
+
|
18
|
+
conn = MiniTest::Mock.new
|
19
|
+
conn.expect(:query, results, ["SHOW TABLES IN mydb;"])
|
20
|
+
|
21
|
+
@cmd.run(conn)
|
22
|
+
end
|
23
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "minitest/autorun"
|
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: athena-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wynn Netherland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '10'
|
19
|
+
name: rake
|
20
|
+
prerelease: false
|
21
|
+
type: :development
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
33
|
+
name: rdoc
|
34
|
+
prerelease: false
|
35
|
+
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.14'
|
47
|
+
name: aruba
|
48
|
+
prerelease: false
|
49
|
+
type: :development
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.5.2
|
61
|
+
name: gli
|
62
|
+
prerelease: false
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.5.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.8.2
|
75
|
+
name: jdbc-helper
|
76
|
+
prerelease: false
|
77
|
+
type: :runtime
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.8.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.5'
|
89
|
+
name: table_print
|
90
|
+
prerelease: false
|
91
|
+
type: :runtime
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.5'
|
97
|
+
description:
|
98
|
+
email: wynn.netherland@gmail.com
|
99
|
+
executables:
|
100
|
+
- athena-cli
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".projections.json"
|
106
|
+
- ".ruby-version"
|
107
|
+
- Gemfile
|
108
|
+
- Gemfile.lock
|
109
|
+
- LICENSE.md
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- athena-cli.gemspec
|
113
|
+
- bin/athena-cli
|
114
|
+
- features/athena.feature
|
115
|
+
- features/step_definitions/athena_steps.rb
|
116
|
+
- features/support/env.rb
|
117
|
+
- lib/amazon_athena.rb
|
118
|
+
- lib/amazon_athena/cli.rb
|
119
|
+
- lib/amazon_athena/client.rb
|
120
|
+
- lib/amazon_athena/command.rb
|
121
|
+
- lib/amazon_athena/commands.rb
|
122
|
+
- lib/amazon_athena/commands/alter_table_add_partition.rb
|
123
|
+
- lib/amazon_athena/commands/alter_table_drop_partition.rb
|
124
|
+
- lib/amazon_athena/commands/create_database.rb
|
125
|
+
- lib/amazon_athena/commands/create_table.rb
|
126
|
+
- lib/amazon_athena/commands/describe_table.rb
|
127
|
+
- lib/amazon_athena/commands/drop_database.rb
|
128
|
+
- lib/amazon_athena/commands/drop_table.rb
|
129
|
+
- lib/amazon_athena/commands/repair_table.rb
|
130
|
+
- lib/amazon_athena/commands/show_columns.rb
|
131
|
+
- lib/amazon_athena/commands/show_create_table.rb
|
132
|
+
- lib/amazon_athena/commands/show_databases.rb
|
133
|
+
- lib/amazon_athena/commands/show_partitions.rb
|
134
|
+
- lib/amazon_athena/commands/show_table_properties.rb
|
135
|
+
- lib/amazon_athena/commands/show_tables.rb
|
136
|
+
- lib/amazon_athena/partition.rb
|
137
|
+
- lib/amazon_athena/transformer.rb
|
138
|
+
- lib/amazon_athena/version.rb
|
139
|
+
- lib/jdbc_helper/athena.rb
|
140
|
+
- lib/jdbc_helper/resultset.rb
|
141
|
+
- log4j.xml
|
142
|
+
- script/bootstrap
|
143
|
+
- script/package
|
144
|
+
- script/release
|
145
|
+
- script/test
|
146
|
+
- test/lib/amazon_athena/commands/alter_table_add_partition_test.rb
|
147
|
+
- test/lib/amazon_athena/commands/alter_table_drop_partition_test.rb
|
148
|
+
- test/lib/amazon_athena/commands/create_database_test.rb
|
149
|
+
- test/lib/amazon_athena/commands/describe_table_test.rb
|
150
|
+
- test/lib/amazon_athena/commands/drop_database_test.rb
|
151
|
+
- test/lib/amazon_athena/commands/drop_table_test.rb
|
152
|
+
- test/lib/amazon_athena/commands/repair_table_test.rb
|
153
|
+
- test/lib/amazon_athena/commands/show_columns_test.rb
|
154
|
+
- test/lib/amazon_athena/commands/show_create_table_test.rb
|
155
|
+
- test/lib/amazon_athena/commands/show_databases_test.rb
|
156
|
+
- test/lib/amazon_athena/commands/show_partitions_test.rb
|
157
|
+
- test/lib/amazon_athena/commands/show_table_properties_test.rb
|
158
|
+
- test/lib/amazon_athena/commands/show_tables_test.rb
|
159
|
+
- test/test_helper.rb
|
160
|
+
homepage: https://wynnnetherland.com
|
161
|
+
licenses:
|
162
|
+
- MIT
|
163
|
+
metadata: {}
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
requirements: []
|
180
|
+
rubyforge_project:
|
181
|
+
rubygems_version: 2.6.8
|
182
|
+
signing_key:
|
183
|
+
specification_version: 4
|
184
|
+
summary: A JRuby-powered CLI for Amazon Athena
|
185
|
+
test_files: []
|