fluent-plugin-sql 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/VERSION +1 -1
- data/lib/fluent/plugin/in_sql.rb +4 -0
- 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: 5b788febd35e3e1fa29da04d73983bdc2af8f35e
|
4
|
+
data.tar.gz: 5a15697f83fe24b1775028ab7b840c28979b63ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24bb0cfd158c87f58f268de4e52c2c5f2f0c414f1659a7bd5d8a34f5c82b423cc4c779d3c08c2e58d280d87e8b4cebef19f0ae12800c12059fb6501dd615a581
|
7
|
+
data.tar.gz: 2d95ea0967c93ed7e0c3aa1f89bce899f5ea004be0c903b25ee067b617fd523621bdc922250bb952843ce6c3a6891af1e82540f535a936433924f7eba8009854
|
data/README.md
CHANGED
@@ -67,7 +67,7 @@ It stores last selected rows to a file (named *state\_file*) to not forget the l
|
|
67
67
|
* **port** RDBMS port
|
68
68
|
* **database** RDBMS database name
|
69
69
|
* **adapter** RDBMS driver name. You should install corresponding gem before start (mysql2 gem for mysql2 adapter, pg gem for postgresql adapter, etc.)
|
70
|
-
* **
|
70
|
+
* **username** RDBMS login user name
|
71
71
|
* **password** RDBMS login password
|
72
72
|
* **tag_prefix** prefix of tags of events. actual tag will be this\_tag\_prefix.tables\_tag (optional)
|
73
73
|
* **select_interval** interval to run SQLs (optional)
|
@@ -81,6 +81,7 @@ It stores last selected rows to a file (named *state\_file*) to not forget the l
|
|
81
81
|
* **table** RDBM table name
|
82
82
|
* **update_column**: see above description
|
83
83
|
* **time_column** (optional): if this option is set, this plugin uses this column's value as the the event's time. Otherwise it uses current time.
|
84
|
+
* **primary_key** (optional): if you want to get data from the table which doesn't have primary key like PostgreSQL's View, set this parameter.
|
84
85
|
|
85
86
|
## Input: Limitation
|
86
87
|
|
@@ -107,6 +108,7 @@ This plugin takes advantage of ActiveRecord underneath. For `host`, `port`, `dat
|
|
107
108
|
|
108
109
|
<table>
|
109
110
|
table table1
|
111
|
+
column_mapping 'timestamp:created_at,fluentdata1:dbcol1,fluentdata2:dbcol2,fluentdata3:dbcol3'
|
110
112
|
# This is the default table because it has no "pattern" field
|
111
113
|
# The logic is such that if all non-default <table> blocks
|
112
114
|
# do not match, the default one is chosen.
|
@@ -136,7 +138,7 @@ This plugin takes advantage of ActiveRecord underneath. For `host`, `port`, `dat
|
|
136
138
|
* **port** RDBMS port
|
137
139
|
* **database** RDBMS database name
|
138
140
|
* **adapter** RDBMS driver name. You should install corresponding gem before start (mysql2 gem for mysql2 adapter, pg gem for postgresql adapter, etc.)
|
139
|
-
* **
|
141
|
+
* **username** RDBMS login user name
|
140
142
|
* **password** RDBMS login password
|
141
143
|
* **socket** RDBMS socket path
|
142
144
|
* **remove_tag_prefix** remove the given prefix from the events. See "tag_prefix" in "Input: Configuration". (optional)
|
@@ -144,5 +146,5 @@ This plugin takes advantage of ActiveRecord underneath. For `host`, `port`, `dat
|
|
144
146
|
\<table\> sections:
|
145
147
|
|
146
148
|
* **table** RDBM table name
|
147
|
-
* **column_mapping**: Record to table schema mapping. The format is consists of `from:to` or `key` values are separated by `,`. For example, if set 'item_id:id,item_text:data,updated_at' to **column_mapping**, `item_id` field of record is stored into `id` column and `updated_at` field of record is stored into `updated_at` column.
|
149
|
+
* **column_mapping**: [Required] Record to table schema mapping. The format is consists of `from:to` or `key` values are separated by `,`. For example, if set 'item_id:id,item_text:data,updated_at' to **column_mapping**, `item_id` field of record is stored into `id` column and `updated_at` field of record is stored into `updated_at` column.
|
148
150
|
* **pattern**: the pattern to which the incoming event's tag (after it goes through `remove_tag_prefix`, if given). The patterns should follow the same syntax as [that of <match>](http://docs.fluentd.org/articles/config-file#match-pattern-how-you-control-the-event-flow-inside-fluentd). **Exactly one <table> element must NOT have this parameter so that it becomes the default table to store data**.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/fluent/plugin/in_sql.rb
CHANGED
@@ -46,6 +46,7 @@ module Fluent
|
|
46
46
|
config_param :tag, :string, :default => nil
|
47
47
|
config_param :update_column, :string, :default => nil
|
48
48
|
config_param :time_column, :string, :default => nil
|
49
|
+
config_param :primary_key, :string, :default => nil
|
49
50
|
|
50
51
|
def configure(conf)
|
51
52
|
super
|
@@ -56,9 +57,12 @@ module Fluent
|
|
56
57
|
|
57
58
|
# creates a model for this table
|
58
59
|
table_name = @table
|
60
|
+
primary_key = @primary_key
|
59
61
|
@model = Class.new(base_model) do
|
60
62
|
self.table_name = table_name
|
61
63
|
self.inheritance_column = '_never_use_'
|
64
|
+
self.primary_key = primary_key if primary_key
|
65
|
+
|
62
66
|
#self.include_root_in_json = false
|
63
67
|
|
64
68
|
def read_attribute_for_serialization(n)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|