embulk-plugin-redis-url 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -1
- data/embulk-plugin-redis.gemspec +1 -1
- data/lib/embulk/output/redis.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca55ebc56bb95a1ed3e65183437f886d26cdecff
|
4
|
+
data.tar.gz: 6281c46d70bb64167f0f474b425616590fc0821e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd8b9b19a867d085c0a661ad869823a5dbe8917356bd153fa0f030b0f011e46eb7ddcf3de9952b10424470cdd02151f670a41d7692cb07aaa2a12c3d33f48c27
|
7
|
+
data.tar.gz: adb9d0b5a7b3e51280d06f0a06a512b00349adf91ac972b30bde57d1b8f5ba5b08c3ddb7df6893a517a9bf5653d63c8d7a53701f546f30a4b5995205bf46ea58
|
data/README.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Embulk input/output plugin for Redis
|
2
2
|
|
3
|
-
This
|
3
|
+
This is a fork of https://github.com/frsyuki/embulk-plugin-redis
|
4
|
+
|
5
|
+
The biggest change is that it accepts a Redis URL connection string.
|
6
|
+
This makes it easy to output to a Compose.io hosted Redis for example.
|
7
|
+
|
8
|
+
It also fixes a few issues and adds some support for working with JSON. It will now,
|
9
|
+
optionally, save a JSON string into Redis with the output plugin. Otherwise, it
|
10
|
+
stores a hash.
|
4
11
|
|
5
12
|
This plugin runs without transaction for now.
|
6
13
|
|
@@ -30,3 +37,21 @@ in:
|
|
30
37
|
key_prefix: user_
|
31
38
|
```
|
32
39
|
|
40
|
+
### New Feature Example
|
41
|
+
|
42
|
+
Assuming Embulk is ingesting log files with line by line JSON strings...This will import
|
43
|
+
to Redis using a key found within the JSON object. An example line item may be:
|
44
|
+
|
45
|
+
```{"id": "myId", "name": "Bob"}```
|
46
|
+
|
47
|
+
The following configuration would use the id value "myId" as a key in Redis with a string
|
48
|
+
value of the entire record.
|
49
|
+
|
50
|
+
```yaml
|
51
|
+
out:
|
52
|
+
type: redis
|
53
|
+
url: redis://x:21345@host.com:6379
|
54
|
+
db: 0
|
55
|
+
is_json: true
|
56
|
+
key: id
|
57
|
+
```
|
data/embulk-plugin-redis.gemspec
CHANGED
data/lib/embulk/output/redis.rb
CHANGED
@@ -12,6 +12,7 @@ module Embulk
|
|
12
12
|
'db' => config.param('db', :integer, :default => 0),
|
13
13
|
'key' => config.param('key', :string),
|
14
14
|
'url' => config.param('url', :string),
|
15
|
+
'is_json' => config.param('is_json', :boolean, :default => false),
|
15
16
|
}
|
16
17
|
|
17
18
|
puts "Redis output started."
|
@@ -39,7 +40,14 @@ module Embulk
|
|
39
40
|
page.each do |record|
|
40
41
|
hash = Hash[schema.names.zip(record)]
|
41
42
|
puts "#{@message}: #{hash.to_json}"
|
42
|
-
|
43
|
+
# puts "key field: #{task['key']}"
|
44
|
+
# puts "key: #{record[0][task['key']]}"
|
45
|
+
# If the data being stored is known to be JSON.
|
46
|
+
if task['is_json']
|
47
|
+
@redis.set(record[0][task['key']], record[0].to_json)
|
48
|
+
else
|
49
|
+
@redis.set(hash[task['key']], hash)
|
50
|
+
end
|
43
51
|
@records += 1
|
44
52
|
end
|
45
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-plugin-redis-url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitsunori Komatsu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|