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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b97423b367fe9075e8cc5deb5089dc46d2c1d3dd
4
- data.tar.gz: 2bbf54cec6d6e3bbf51da0c54a2cb545201ec446
3
+ metadata.gz: ca55ebc56bb95a1ed3e65183437f886d26cdecff
4
+ data.tar.gz: 6281c46d70bb64167f0f474b425616590fc0821e
5
5
  SHA512:
6
- metadata.gz: 1dc05a7f11392afbcd6839503c91e0471cfb07f525d3f51ac97bef31a5b30f18bd8086275a4004254efc561a8ce710fb7f6773ab4c64c81f6292f1dd7cb4234b
7
- data.tar.gz: 7f12b8f2759a9b5727e1775280910eade19a6dc87a72dd66fa29cdb79e1f30ba5639deca20a8debc50f0bdec4e8e8f6acb8e51896bca6dbd57d16e1588273015
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 [Embulk](https://github.com/embulk/embulk) output plugin writes records to a json column of a table.
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
+ ```
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "embulk-plugin-redis-url"
4
- gem.version = "0.3.0"
4
+ gem.version = "0.4.0"
5
5
 
6
6
  gem.summary = %q{Embulk plugin for Redis (with URL connection string support)}
7
7
  gem.description = gem.summary
@@ -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
- @redis.set(hash[task['key']], hash)
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.3.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-28 00:00:00.000000000 Z
12
+ date: 2016-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis