fluent-plugin-mysql-load 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 694e88114b2538b250ecbf498b4351f06fdda1d0
4
+ data.tar.gz: 0d9d81e11ca091d49b1fd8620902d71a8740dcae
5
+ SHA512:
6
+ metadata.gz: b93240239bcaac9cb8ab02480a73cb55bd873e60f686a6cee1b6a81d571d0aa097ace435c5c2a57c74ff261168c9c52e11542dd44787bebb1906e1d6ba449aa1
7
+ data.tar.gz: b32a77a8148fe0b9dea6daebfbb448eeb8b63a5c233657fb670de6922230e66eba3030b6e1f23fa9c91d2d614bb04925c5a249b14136c133042f4c71bb85a88d
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.1.1
5
+ - 2.0.0
6
+ - 1.9.3
7
+
8
+ before_script:
9
+ - mysql < setup-mysql.sql
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-mysql-load.gemspec
4
+ gemspec
5
+ gem "mysql2"
@@ -0,0 +1,203 @@
1
+ Copyright (c) 2014 Fukui ReTu
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [2014] [Fukui ReTu]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
@@ -0,0 +1,83 @@
1
+ # fluent-plugin-mysql-load, a plugin for [Fluentd](http://fluentd.org) [![Build Status](https://travis-ci.org/fukuiretu/fluent-plugin-mysql-load.svg?branch=master)](https://travis-ci.org/fukuiretu/fluent-plugin-mysql-load)
2
+
3
+
4
+ # Overview
5
+
6
+ "fluent-plugin-mysql-load" is a plugin fluentd.
7
+
8
+ Output filter plugin to mysql import.
9
+ Internal processing uses the "LOAD DATA INFILE".
10
+
11
+ [MySQL Manual of LOAD DATA is here](http://dev.mysql.com/doc/refman/5.6/en/load-data.html)
12
+
13
+ # Configuration
14
+ ## Ex.
15
+ ```
16
+ <match loaddata.**>
17
+ type mysql_load
18
+ password password
19
+ database fluentd
20
+ tablename test
21
+ columns txt,txt2,txt3
22
+
23
+ buffer_type file
24
+ buffer_path /var/log/fluent/test.*.buffer
25
+ flush_interval 60s
26
+ </match>
27
+ ```
28
+
29
+ ## In.
30
+ ```
31
+ loaddata.test: {"seq":1,"txt":"hoge","txt2":"foo","txt3":"bar","createte_at":"2014-01-01 00:00:00"}
32
+ loaddata.test: {"seq":2,"txt":"hoge2","txt2":"foo2","txt3":"bar2","createte_at":"2014-01-01 00:00:01"}
33
+ loaddata.test: {"seq":3,"txt":"hoge3","txt2":"foo3","txt3":"bar3","createte_at":"2014-01-01 00:00:02"}
34
+ ```
35
+
36
+ ## Out.
37
+ ```
38
+ +------------------+---------------------+---------------------+
39
+ | txt | txt2 | txt3 |
40
+ +------------------+---------------------+---------------------+
41
+ | hoge | foo | bar |
42
+ | hoge2 | foo2 | bar2 |
43
+ | hoge3 | foo3 | bar3 |
44
+ +------------------+---------------------+---------------------+
45
+ ```
46
+
47
+ # Parameters
48
+
49
+ * host(option)
50
+
51
+ Set the host name of MySQL Server.The default is "localhost".
52
+
53
+ * port(option)
54
+
55
+ Set the port of MySQL Server.The default is "3306".
56
+
57
+ * username(option)
58
+
59
+ Set the user of MySQL Server.The default is "root".
60
+
61
+ * password(option)
62
+
63
+ Set the password of MySQL Server.The default is ""(blank).
64
+
65
+ * database(required)
66
+
67
+ Set the database of MySQL Server.
68
+
69
+ * tablename(required)
70
+
71
+ Set the table name of the import data.
72
+
73
+ * columns(option)
74
+
75
+ Set if you want to specify the column of the table of data import destination.Attaches to the string key of the input data.
76
+
77
+ * encoding(option)
78
+
79
+ Set the encode of MySQL Server.The default is "utf8".
80
+
81
+
82
+ # Copyright
83
+ Copyright:: Copyright (c) 2014- Fukui ReTu License:: Apache License, Version 2.0
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+ Rake::TestTask.new(:test) do |test|
4
+ test.libs << 'lib' << 'test'
5
+ test.pattern = 'test/**/test_*.rb'
6
+ test.verbose = true
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ require 'mysql2'
4
+ require 'tempfile'
5
+
6
+ ###### config start
7
+ host = "localhost" # req
8
+ database = "fluentd" # req
9
+ username = "root" # req
10
+ password = "yywx27" # req
11
+ tablename = "test" # req
12
+ columns = "txt,txt2" # option
13
+ data_file_path = "/Users/fukui_retu/myhome/dev/workspaces/fluent-plugin-mysql-load/exsamples/testdata.txt" # これは本来はいらない
14
+ fields_delimiter = "," # option.(default:",")いらない
15
+ fields_enclosed_optionally = true # option いらない
16
+ fields_enclosed = '"' # optionいらない
17
+ fields_escaped = '\\\\' # option いらない
18
+ lines_terminated = "\n" # option .(default:"¥n")いらない
19
+ lines_starting = ">" # option いらない
20
+ ignore_lines = 1 # optionいらない
21
+ ###### config end
22
+
23
+ client ||= Mysql2::Client.new(:host => host, :username => username, :password => password, :database => database)
24
+ client.query("SELECT * FROM test").each do |r|
25
+ puts r
26
+ end
27
+
28
+ # load data in fileを試す
29
+ query = "LOAD DATA INFILE \"#{data_file_path}\" INTO TABLE #{tablename}"
30
+ query += " FIELDS TERMINATED BY '#{fields_delimiter}' ENCLOSED BY '#{fields_enclosed}' ESCAPED BY '#{fields_escaped}'"
31
+ query += " LINES TERMINATED BY '#{lines_terminated}' STARTING BY '#{lines_starting}'"
32
+ query += " IGNORE #{ignore_lines} LINES"
33
+ query += " (#{columns})"
34
+ print query
35
+
36
+ result = client.query(query);
@@ -0,0 +1,4 @@
1
+ hederdayo
2
+ >hogehoge,foofoo
3
+ >hogehogehoge,foofoofoo
4
+ >hogehogehogehoge,foofoofoofoo
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ Gem::Specification.new do |spec|
3
+ spec.name = "fluent-plugin-mysql-load"
4
+ spec.version = "0.0.1"
5
+ spec.authors = ["Fukui ReTu"]
6
+ spec.email = ["s0232101@gmail.com"]
7
+ spec.description = %q{Output filter plugin to mysql import}
8
+ spec.summary = %q{Output filter plugin to mysql import}
9
+ spec.homepage = "https://github.com/fukuiretu/fluent-plugin-mysql-load"
10
+ spec.license = "APL2.0"
11
+
12
+ spec.rubyforge_project = "fluent-plugin-mysql-load"
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_development_dependency "bundler", "~> 1.3"
19
+ spec.add_development_dependency "rake"
20
+ spec.add_runtime_dependency "fluentd"
21
+ spec.add_runtime_dependency "mysql2"
22
+ end
@@ -0,0 +1,88 @@
1
+ module Fluent
2
+ class MysqlLoadOutput < Fluent::BufferedOutput
3
+ Fluent::Plugin.register_output('mysql_load', self)
4
+
5
+ QUERY_TEMPLATE = "LOAD DATA LOCAL INFILE '%s' INTO TABLE %s (%s)"
6
+
7
+ # Define `log` method for v0.10.42 or earlier
8
+ unless method_defined?(:log)
9
+ define_method("log") { $log }
10
+ end
11
+
12
+ def initialize
13
+ require 'mysql2'
14
+ require 'tempfile'
15
+ super
16
+ end
17
+
18
+ config_param :host, :string, :default => 'localhost'
19
+ config_param :port, :integer, :default => 3306
20
+ config_param :username, :string, :default => 'root'
21
+ config_param :password, :string, :default => nil
22
+ config_param :database, :string, :default => nil
23
+ config_param :tablename, :string, :default => nil
24
+ config_param :columns, :string, :default => nil
25
+ config_param :encoding, :string, :default => 'utf8'
26
+
27
+ def configure(conf)
28
+ super
29
+ if @database.nil? || @tablename.nil?
30
+ raise Fluent::ConfigError, "database and tablename is required!"
31
+ end
32
+
33
+ if (!@columns.nil?)
34
+ @columns = @columns.split(",")
35
+ end
36
+ end
37
+
38
+ def start
39
+ super
40
+ end
41
+
42
+ def shutdown
43
+ super
44
+ end
45
+
46
+ def format(tag, time, record)
47
+ record.to_msgpack
48
+ end
49
+
50
+ def write(chunk)
51
+ tmp = Tempfile.new("loaddata")
52
+ keys = nil
53
+ chunk.msgpack_each { |record|
54
+ # keyの取得は初回のみ
55
+ if keys.nil?
56
+ # columnsが指定されている場合はそっちを有効にする
57
+ keys = @columns.nil? ? record.keys : @columns
58
+ end
59
+
60
+ values = []
61
+ keys.each{ |key|
62
+ values << record[key]
63
+ }
64
+
65
+ tmp.write values.join("\t") + "\n"
66
+ }
67
+ tmp.close
68
+
69
+ query = QUERY_TEMPLATE % ([tmp.path, @tablename, keys.join(",")])
70
+
71
+ conn = get_connection
72
+ conn.query(query)
73
+ conn.close
74
+ end
75
+
76
+ private
77
+ def get_connection
78
+ Mysql2::Client.new({
79
+ :host => @host,
80
+ :port => @port,
81
+ :username => @username,
82
+ :password => @password,
83
+ :database => @database,
84
+ :encoding => @encoding
85
+ })
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,9 @@
1
+ CREATE DATABASE IF NOT EXISTS fluentd;
2
+ USE fluentd;
3
+
4
+ CREATE TABLE IF NOT EXISTS `test` (
5
+ `id` int(11) NOT NULL AUTO_INCREMENT,
6
+ `txt` text,
7
+ `txt2` text,
8
+ PRIMARY KEY (`id`)
9
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
14
+ require 'fluent/test'
15
+ unless ENV.has_key?('VERBOSE')
16
+ nulllogger = Object.new
17
+ nulllogger.instance_eval {|obj|
18
+ def method_missing(method, *args)
19
+ # pass
20
+ end
21
+ }
22
+ $log = nulllogger
23
+ end
24
+
25
+ require 'fluent/plugin/out_mysql_load'
26
+
27
+ class Test::Unit::TestCase
28
+ end
@@ -0,0 +1,89 @@
1
+ require 'helper'
2
+
3
+ class MysqlLoadOutputTest < Test::Unit::TestCase
4
+ def setup
5
+ Fluent::Test.setup
6
+ end
7
+
8
+ CONFIG = %[
9
+ database fluentd
10
+ tablename test
11
+ ]
12
+
13
+ def create_driver(conf = CONFIG, tag='test')
14
+ Fluent::Test::BufferedOutputTestDriver.new(Fluent::MysqlLoadOutput, tag).configure(conf)
15
+ end
16
+
17
+ def test_configure_default
18
+ d = create_driver
19
+
20
+ assert_equal 'localhost', d.instance.host
21
+ assert_equal 3306, d.instance.port
22
+ assert_equal 'root', d.instance.username
23
+ assert_equal 'utf8', d.instance.encoding
24
+ end
25
+
26
+ def test_configure_custom
27
+ d = create_driver %[
28
+ host abcde
29
+ port 33306
30
+ username taro
31
+ password pldoeudku
32
+ database db
33
+ encoding sjis
34
+ tablename test
35
+ columns a,b,c,d,e
36
+ ]
37
+
38
+ assert_equal 'abcde', d.instance.host
39
+ assert_equal 33306, d.instance.port
40
+ assert_equal 'taro', d.instance.username
41
+ assert_equal 'pldoeudku', d.instance.password
42
+ assert_equal 'db', d.instance.database
43
+ assert_equal 'sjis', d.instance.encoding
44
+ assert_equal 'test', d.instance.tablename
45
+ assert_equal ['a', 'b', 'c', 'd', 'e'], d.instance.columns
46
+ end
47
+
48
+ def test_configure_error
49
+ assert_raise(Fluent::ConfigError) do
50
+ create_driver %[
51
+ host abcde
52
+ port 33306
53
+ username taro
54
+ password pldoeudku
55
+ encoding sjis
56
+ tablename test
57
+ columns a,b,c,d,e
58
+ ]
59
+ end
60
+
61
+ assert_raise(Fluent::ConfigError) do
62
+ create_driver %[
63
+ host abcde
64
+ port 33306
65
+ username taro
66
+ password pldoeudku
67
+ database db
68
+ encoding sjis
69
+ columns a,b,c,d,e
70
+ ]
71
+ end
72
+ end
73
+
74
+ def test_format
75
+ d = create_driver
76
+
77
+ d.emit({"id"=>1, "txt" => "hoge", "txt2" => "foo"})
78
+ d.emit({"id"=>2, "txt" => "hoge2", "txt2" => "foo2"})
79
+
80
+ d.expect_format({"id"=>1, "txt" => "hoge", "txt2" => "foo"}.to_msgpack)
81
+ d.expect_format({"id"=>2, "txt" => "hoge2", "txt2" => "foo2"}.to_msgpack)
82
+
83
+ # d.run
84
+ end
85
+
86
+ def test_write
87
+ # TODO
88
+ end
89
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-mysql-load
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Fukui ReTu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: fluentd
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mysql2
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Output filter plugin to mysql import
70
+ email:
71
+ - s0232101@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .travis.yml
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - exsamples/connect_to_mysql.rb
83
+ - exsamples/testdata.txt
84
+ - fluent-plugin-mysql-load.gemspec
85
+ - lib/fluent/plugin/out_mysql_load.rb
86
+ - setup-mysql.sql
87
+ - test/helper.rb
88
+ - test/plugin/test_out_mysql_load.rb
89
+ homepage: https://github.com/fukuiretu/fluent-plugin-mysql-load
90
+ licenses:
91
+ - APL2.0
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project: fluent-plugin-mysql-load
109
+ rubygems_version: 2.0.14
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Output filter plugin to mysql import
113
+ test_files:
114
+ - test/helper.rb
115
+ - test/plugin/test_out_mysql_load.rb