ath 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 21a47438e2f1e99a854aa23c1bd7301e217e3266
4
- data.tar.gz: 014b49b565e36d3ca64e4e5f3c7c5ab1de54e0b1
3
+ metadata.gz: eb806476d2749543f41ac3e801cd9af8af2b3082
4
+ data.tar.gz: 0c4ae894e1fbca69275fec6ff15d7a549f0b9b16
5
5
  SHA512:
6
- metadata.gz: e59acba379c679e781eef4a4324e38a8ff5b69962d91c6fa4bd5abda578405dbbe8dfa1848a590251e25ec813ce3335f72df4a83e144171474f68e20a549c743
7
- data.tar.gz: faa08d22bb15c6bcad6fbe1477ade5b1247e1bc57c52823358bf286dc62e9db2f766882d607c8437ba1985d8cc4b3babcded8c2f2c36bd44d7d3cdf10ed9874a
6
+ metadata.gz: 5dad41ecaac38804705d303fb47e5fb91fceaa3ea7b4a7f1b10e13f80dc536525c810659a17c694cf591f0c3f568b28e78fc6d059f9bdf662d0ecefa08dec3f7
7
+ data.tar.gz: b296e942ad27658a2f8c285ca6e9c232e7c50462a435a3882c5ccf186c45dc148fbc71175e2f804b68e656f739217b6ce512491dda399a3f657f8d53b87938d3
data/README.md CHANGED
@@ -22,6 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ```
24
24
  $ export ATH_OUTPUT_LOCATION=s3://my-bucket
25
+ $ #export ATH_PAGER='column -t -s,'
25
26
 
26
27
  $ ath
27
28
 
@@ -68,6 +69,32 @@ sampledb> /result 2335c77b-d138-4c5d-89df-12f2781c311b
68
69
  "2015-01-01T16:00:00.516940Z","elb_demo_009","242.76.140.141","18201","172.42.159.57","80","0.001448","8.46E-4","9.97E-4","302","302","0","2911","GET","https://www.example.com/articles/817","HTTP/1.1","""Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1""","DHE-RSA-AES128-SHA","TLSv1.2"
69
70
  "2015-01-01T16:00:00.902953Z","elb_demo_005","246.233.91.115","1950","172.42.232.155","8888","9.59E-4","0.001703","8.93E-4","200","200","0","3027","GET","http://www.example.com/jobs/509","HTTP/1.1","""Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50""","-","-"
70
71
  "2015-01-01T16:00:01.206255Z","elb_demo_002","250.96.73.238","12800","172.34.87.144","80","0.001549","9.68E-4","0.001908","200","200","0","888","GET","http://www.example.com/articles/729","HTTP/1.1","""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246""","-","-"
72
+
73
+ sampledb> /pager column -t -s,
74
+
75
+ sampledb> select elb_name, count(*) from elb_logs group by elb_name;
76
+ "elb_name" "_col1"
77
+ "elb_demo_006" "151901"
78
+ "elb_demo_008" "150503"
79
+ "elb_demo_007" "149122"
80
+ "elb_demo_001" "151753"
81
+ "elb_demo_005" "149934"
82
+ "elb_demo_009" "151886"
83
+ "elb_demo_004" "151062"
84
+ "elb_demo_002" "151284"
85
+ "elb_demo_003" "148761"
86
+
87
+ sampledb> /list 1
88
+ 2017-07-03 20:52:24 +0900 cf881630-a845-424a-8035-afe155505cac SUCCEEDED select elb_name cou..
89
+
90
+ default> /save cf881630-a845-424a-8035-afe155505cac
91
+ Save to /Users/.../cf881630-a845-424a-8035-afe155505cac.csv
92
+ ```
93
+
94
+ ```
95
+ $ echo 'select count(*) from elb_logs' | ath -d sampledb -f -
96
+ "_col0"
97
+ "1356206"
71
98
  ```
72
99
 
73
100
  ## Usage
data/exe/ath CHANGED
@@ -10,6 +10,7 @@ Version = Ath::VERSION
10
10
  options = {
11
11
  database: 'default',
12
12
  output_location: ENV['ATH_OUTPUT_LOCATION'],
13
+ pager: ENV['ATH_PAGER'],
13
14
  debug: false,
14
15
  }
15
16
 
@@ -30,6 +31,7 @@ ARGV.options do |opt|
30
31
  opt.on('-d', '--database DATABASE') {|v| options[:database] = v }
31
32
  opt.on('-e', '--execute QUERY') {|v| query = v }
32
33
  opt.on('-f', '--file QUERY_FILR') {|v| query_file = v }
34
+ opt.on('', '--pager PAGER') {|v| options[:pager] = v }
33
35
  opt.on('', '--[no-]progress') {|v| options[:progress] = v }
34
36
  opt.on('' , '--debug') { options[:debug] = true }
35
37
  opt.parse!
@@ -65,6 +67,7 @@ begin
65
67
  shell = Ath::Shell.new(
66
68
  output_location: options.delete(:output_location),
67
69
  database: options.delete(:database),
70
+ pager: options.delete(:pager),
68
71
  options: options)
69
72
 
70
73
  if query_file
data/lib/ath/shell.rb CHANGED
@@ -6,8 +6,9 @@ class Ath::Shell
6
6
  attr_reader :options
7
7
  attr_accessor :pager
8
8
 
9
- def initialize(athena: Aws::Athena::Client.new, s3: Aws::S3::Client.new, output_location:, database: nil, options: {})
9
+ def initialize(athena: Aws::Athena::Client.new, s3: Aws::S3::Client.new, output_location:, database: nil, pager: nil, options: {})
10
10
  @driver = Ath::Driver.new(athena: athena, s3: s3, output_location: output_location, database: database, options: options)
11
+ @pager = pager
11
12
  @options = options
12
13
  @scanner = Ath::Scanner.new(shell: self)
13
14
  end
data/lib/ath/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ath
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel