ddbcli 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dc0c0d2ef3366f4919ba4d115c7658a581fdd1c
4
- data.tar.gz: 13fd94d5136a425742048ad4df518029d3dfb47e
3
+ metadata.gz: a2663c07f16634940a971202a87ddea5f60e133f
4
+ data.tar.gz: d9306478c3e8be4942449f43eaa19d682bdf1a12
5
5
  SHA512:
6
- metadata.gz: 8e9bb7266ef5ef2d271cd6574f882d4d40bf033e4bf30fb511326504963cc9e594a3f42f066c1badbf3352d8da0a41f9d592f93fd36700b4a51ecb41d25f664a
7
- data.tar.gz: 182ff427980863a1b493b30cc1576091129424b06ee6363080d1ccdde760f2bab85f7af4d10fa9ec82ff06fda1b95e45a7b2aee1786561170ec376d5e6cd76ed
6
+ metadata.gz: 49b466908f67aefa67857b059ebcba8417c9d4d676a54d9a3460e3b380f746fb297ea2de0b53ae71d149f69cdafd98522c5b49bcf5524b8574ba5179be5ee8e5
7
+ data.tar.gz: 596e4909099e1673803eb50b8d64609a53f196d4b993818292ec01bce671c4c8c96a5cb97796ed145a65de5576fde669f26db03ac16e804f41412094bbee3c14
data/README.md CHANGED
@@ -10,11 +10,11 @@ ddbcli is an interactive command-line client of Amazon DynamoDB.
10
10
 
11
11
  If you are not using RubyGems, you can use the script files that depend on only Ruby.
12
12
 
13
- [ddbcli-0.3.2](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.2)
13
+ [ddbcli-0.3.3](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.3)
14
14
 
15
15
  ```sh
16
- wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.2
17
- sudo cp ddbcli-0.3.2 /usr/local/bin/ddbcli
16
+ wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.3
17
+ sudo cp ddbcli-0.3.3 /usr/local/bin/ddbcli
18
18
  sudo chmod 755 /usr/local/bin/ddbcli
19
19
  ```
20
20
 
@@ -512,6 +512,26 @@ module DynamoDB
512
512
  end
513
513
  end
514
514
 
515
+ global_secondary_indexes = (table_info['GlobalSecondaryIndexes'] || [])
516
+
517
+ unless global_secondary_indexes.empty?
518
+ req_hash['GlobalSecondaryIndexes'] = global_secondary_indexes.map do |gsi|
519
+ h = {}
520
+
521
+ %w(IndexName KeySchema Projection).each do |i|
522
+ h[i] = gsi[i]
523
+ end
524
+
525
+ h['ProvisionedThroughput'] = h_pt = {}
526
+
527
+ %w(ReadCapacityUnits WriteCapacityUnits).each do |i|
528
+ h_pt[i] = gsi['ProvisionedThroughput'][i]
529
+ end
530
+
531
+ h
532
+ end
533
+ end
534
+
515
535
  if parsed.capacity
516
536
  req_hash['ProvisionedThroughput'] = {
517
537
  'ReadCapacityUnits' => parsed.capacity[:read],
@@ -1,5 +1,5 @@
1
1
  module DynamoDB
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
4
4
 
5
5
  Version = DynamoDB::VERSION
data/spec/ddbcli_spec.rb CHANGED
@@ -152,7 +152,7 @@ describe 'ddbcli' do
152
152
  )
153
153
  end
154
154
 
155
- it 'create table with GSI' do
155
+ it 'alter table' do
156
156
  ddbcli(<<-'EOS')
157
157
  CREATE TABLE `foo` (
158
158
  `id` NUMBER HASH,
@@ -193,4 +193,48 @@ describe 'ddbcli' do
193
193
  "ItemCount"=>0}]}
194
194
  )
195
195
  end
196
+
197
+ it 'create table like' do
198
+ pending('GSI does not work in DynamoDB Local')
199
+
200
+ ddbcli(<<-'EOS')
201
+ CREATE TABLE `foo` (
202
+ `id` NUMBER HASH,
203
+ `val` STRING RANGE,
204
+ GLOBAL INDEX `idx_bar` (`val2` STRING) ALL read=1 write=1
205
+ ) read=2 write=2
206
+ EOS
207
+
208
+ ddbcli('create table foo2 like foo')
209
+
210
+ out = ddbcli('desc foo2')
211
+ out = JSON.parse(out)
212
+ out.delete('CreationDateTime')
213
+
214
+ expect(out).to eq(
215
+ {"AttributeDefinitions"=>
216
+ [{"AttributeName"=>"id", "AttributeType"=>"N"},
217
+ {"AttributeName"=>"val", "AttributeType"=>"S"},
218
+ {"AttributeName"=>"val2", "AttributeType"=>"S"}],
219
+ "TableName"=>"foo2",
220
+ "KeySchema"=>
221
+ [{"AttributeName"=>"id", "KeyType"=>"HASH"},
222
+ {"AttributeName"=>"val", "KeyType"=>"RANGE"}],
223
+ "TableStatus"=>"ACTIVE",
224
+ "ProvisionedThroughput"=>
225
+ {"NumberOfDecreasesToday"=>0,
226
+ "ReadCapacityUnits"=>2,
227
+ "WriteCapacityUnits"=>2},
228
+ "TableSizeBytes"=>0,
229
+ "ItemCount"=>0,
230
+ "GlobalSecondaryIndexes"=>
231
+ [{"IndexName"=>"idx_bar",
232
+ "KeySchema"=>[{"AttributeName"=>"val2", "KeyType"=>"HASH"}],
233
+ "Projection"=>{"ProjectionType"=>"ALL"},
234
+ "IndexStatus"=>"ACTIVE",
235
+ "ProvisionedThroughput"=>{"ReadCapacityUnits"=>1, "WriteCapacityUnits"=>1},
236
+ "IndexSizeBytes"=>0,
237
+ "ItemCount"=>0}]}
238
+ )
239
+ end
196
240
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddbcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara