ddbcli 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -12
- data/lib/ddbcli/cli/help.rb +4 -3
- data/lib/ddbcli/ddb-driver.rb +15 -0
- data/lib/ddbcli/ddb-parser.tab.rb +410 -391
- data/lib/ddbcli/ddb-parser.y +11 -4
- data/lib/ddbcli/version.rb +1 -1
- data/spec/spec_helper.rb +9 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ed0ee9d9dc097573bbdf49182bcef2a8751af2e
|
4
|
+
data.tar.gz: 112ce4939ccb1cbfb083bc785cae474427b1f03d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe3469ade8447b7a46fe768a75e8939b01b1486193e69b201d2ae4c4f0d4452b37db3dd9c17a3dea76b4a5215fa38766b5d6243559771bffbecfae696935a35
|
7
|
+
data.tar.gz: 4edef9cd083130f4f1f39abb280c1e28c272fec6769817b98de87cca7bb4978c77c2b9b478d6dce9792a4ef0b741778f1998a84377b832ed6878b72da066aaab
|
data/README.md
CHANGED
@@ -11,12 +11,13 @@ ddbcli is an interactive command-line client of Amazon DynamoDB.
|
|
11
11
|
|
12
12
|
If you are not using RubyGems, you can use the script files that depend on only Ruby.
|
13
13
|
|
14
|
-
[ddbcli-0.3.
|
14
|
+
[ddbcli-0.3.6](https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.6)
|
15
15
|
|
16
16
|
```sh
|
17
|
-
wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.
|
18
|
-
|
19
|
-
|
17
|
+
wget https://bitbucket.org/winebarrel/ddbcli/downloads/ddbcli-0.3.6
|
18
|
+
mv ddbcli-0.3.6 ddbcli
|
19
|
+
chmod 755 ddbcli
|
20
|
+
./ddbcli # show prompt
|
20
21
|
```
|
21
22
|
|
22
23
|
## Usage
|
@@ -61,7 +62,7 @@ DEBUG: 'i' contains: [{"gender"=>"F"}, {"gender"=>"F"}, {"gender"=>"F"}] ...
|
|
61
62
|
|
62
63
|
* [https://gist.github.com/winebarrel/7938971](https://gist.github.com/winebarrel/7938971)
|
63
64
|
|
64
|
-
##
|
65
|
+
## Enable ctrl-r (reverse-search-history) on OS X
|
65
66
|
|
66
67
|
$ echo 'bind "^R" em-inc-search-prev' >> ~/.editrc
|
67
68
|
|
@@ -121,7 +122,7 @@ DELETE ALL FROM table_name WHERE [WHERE attr1 = '...' AND ...] [ORDER {ASC|DESC}
|
|
121
122
|
deletes items
|
122
123
|
("DELETE" can delete only one record. Please use "DELETE ALL", when you update more than one.)
|
123
124
|
|
124
|
-
SELECT {*|attr1,attr2,...|COUNT(*)} FROM table_name [USE INDEX (index_name)] [WHERE key1 = '...' AND ...] [ORDER {ASC|DESC}] [LIMIT limit]
|
125
|
+
SELECT {*|attr1,attr2,...|COUNT(*)} FROM table_name [USE INDEX (index_name)] [WHERE key1 = '...' AND ...] [HAVING attr1 = '...' AND ...] [ORDER {ASC|DESC}] [LIMIT limit]
|
125
126
|
SELECT ALL {*|attr1,attr2,...|COUNT(*)} FROM table_name [WHERE attr1 = '...' AND ...] [LIMIT limit]
|
126
127
|
SELECT segment/total_segments {*|attr1,attr2,...|COUNT(*)} FROM table_name [WHERE attr1 = '...' AND ...] [LIMIT limit]
|
127
128
|
queries using the Query/Scan action
|
@@ -162,9 +163,10 @@ Query (SELECT)
|
|
162
163
|
= | <= | < | >= | > | BEGINS_WITH | BETWEEN
|
163
164
|
see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditions
|
164
165
|
|
165
|
-
Scan (SELECT ALL)
|
166
|
+
Scan (SELECT ALL), QueryFilter (HAVING)
|
166
167
|
= | <> | != | <= | < | >= | > | IS NOT NULL | IS NULL | CONTAINS | NOT CONTAINS | BEGINS_WITH | IN | BETWEEN
|
167
|
-
see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html#DDB-Scan-request-ScanFilter
|
168
|
+
see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html#DDB-Scan-request-ScanFilter,
|
169
|
+
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-QueryFilter
|
168
170
|
|
169
171
|
|
170
172
|
##### Pass to Ruby/Shell #####
|
@@ -211,7 +213,3 @@ Append
|
|
211
213
|
.timeout SECOND? displays a timeout second or changes it
|
212
214
|
.version displays a version
|
213
215
|
```
|
214
|
-
|
215
|
-
## Link
|
216
|
-
|
217
|
-
* [RubyGems.org site](http://rubygems.org/gems/ddbcli)
|
data/lib/ddbcli/cli/help.rb
CHANGED
@@ -55,7 +55,7 @@ DELETE ALL FROM table_name WHERE [WHERE attr1 = '...' AND ...] [ORDER {ASC|DESC}
|
|
55
55
|
deletes items
|
56
56
|
("DELETE" can delete only one record. Please use "DELETE ALL", when you update more than one.)
|
57
57
|
|
58
|
-
SELECT {*|attr1,attr2,...|COUNT(*)} FROM table_name [USE INDEX (index_name)] [WHERE key1 = '...' AND ...] [ORDER {ASC|DESC}] [LIMIT limit]
|
58
|
+
SELECT {*|attr1,attr2,...|COUNT(*)} FROM table_name [USE INDEX (index_name)] [WHERE key1 = '...' AND ...] [HAVING attr1 = '...' AND ...] [ORDER {ASC|DESC}] [LIMIT limit]
|
59
59
|
SELECT ALL {*|attr1,attr2,...|COUNT(*)} FROM table_name [WHERE attr1 = '...' AND ...] [LIMIT limit]
|
60
60
|
SELECT segment/total_segments {*|attr1,attr2,...|COUNT(*)} FROM table_name [WHERE attr1 = '...' AND ...] [LIMIT limit]
|
61
61
|
queries using the Query/Scan action
|
@@ -96,9 +96,10 @@ Query (SELECT)
|
|
96
96
|
= | <= | < | >= | > | BEGINS_WITH | BETWEEN
|
97
97
|
see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditions
|
98
98
|
|
99
|
-
Scan (SELECT ALL)
|
99
|
+
Scan (SELECT ALL), QueryFilter (HAVING)
|
100
100
|
= | <> | != | <= | < | >= | > | IS NOT NULL | IS NULL | CONTAINS | NOT CONTAINS | BEGINS_WITH | IN | BETWEEN
|
101
|
-
see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html#DDB-Scan-request-ScanFilter
|
101
|
+
see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html#DDB-Scan-request-ScanFilter,
|
102
|
+
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-QueryFilter
|
102
103
|
|
103
104
|
|
104
105
|
##### Pass to Ruby/Shell #####
|
data/lib/ddbcli/ddb-driver.rb
CHANGED
@@ -604,6 +604,21 @@ module DynamoDB
|
|
604
604
|
end
|
605
605
|
end # key conditions / scan filter
|
606
606
|
|
607
|
+
# query filter
|
608
|
+
if action == 'Query' and parsed.having
|
609
|
+
req_hash['QueryFilter'] = {}
|
610
|
+
|
611
|
+
parsed.having.each do |key, operator, values|
|
612
|
+
h = req_hash['QueryFilter'][key] = {
|
613
|
+
'ComparisonOperator' => operator.to_s
|
614
|
+
}
|
615
|
+
|
616
|
+
h['AttributeValueList'] = values.map do |val|
|
617
|
+
convert_to_attribute_value(val)
|
618
|
+
end
|
619
|
+
end
|
620
|
+
end # query filter
|
621
|
+
|
607
622
|
rd = nil
|
608
623
|
|
609
624
|
begin
|