fluent-plugin-sql 2.2.0 → 2.3.0
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/ChangeLog +4 -0
- data/README.md +3 -0
- data/VERSION +1 -1
- data/lib/fluent/plugin/in_sql.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88024ff651d07318ed1d0abf03a0c43601e61288356544c53805a7678e6e5c45
|
4
|
+
data.tar.gz: 020b0a879adfa39a5130105e9c75ed1d3e65574de63624a52f698c91b3e48d48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c258a8f2b9eb8dbc78cfe1709cfcee97b647d1ab4067bc1e47624dc296ea3196b313b0d7fd2543f37cdbd67598b846507a1ee0f705d1d9e338098bd3977e28e9
|
7
|
+
data.tar.gz: a32904e86a3d30a586e745a60fb48f4e43a78e427a32ea81beba225dba858c7aff9a3afb85e1ce5d7325daea1505a200845d38d330cadd0c47f8e85edab7a26c
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -44,6 +44,7 @@ It stores last selected rows to a file (named *state\_file*) to not forget the l
|
|
44
44
|
@type sql
|
45
45
|
|
46
46
|
host rdb_host
|
47
|
+
port rdb_port
|
47
48
|
database rdb_database
|
48
49
|
adapter mysql2_or_postgresql_or_etc
|
49
50
|
username myusername
|
@@ -68,6 +69,7 @@ It stores last selected rows to a file (named *state\_file*) to not forget the l
|
|
68
69
|
tag table2 # optional
|
69
70
|
update_column updated_at
|
70
71
|
time_column updated_at # optional
|
72
|
+
time_format %Y-%m-%d %H:%M:%S.%6N # optional
|
71
73
|
</table>
|
72
74
|
|
73
75
|
# detects all tables instead of <table> sections
|
@@ -93,6 +95,7 @@ It stores last selected rows to a file (named *state\_file*) to not forget the l
|
|
93
95
|
* **update_column**: see above description
|
94
96
|
* **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.
|
95
97
|
* **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.
|
98
|
+
* **time_format** (optional): if you want to specify the format of the date used in the query, useful when using alternative adapters which have restrictions on format
|
96
99
|
|
97
100
|
## Input: Limitation
|
98
101
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/lib/fluent/plugin/in_sql.rb
CHANGED
@@ -59,7 +59,7 @@ module Fluent::Plugin
|
|
59
59
|
config_param :update_column, :string, default: nil
|
60
60
|
config_param :time_column, :string, default: nil
|
61
61
|
config_param :primary_key, :string, default: nil
|
62
|
-
|
62
|
+
config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S.%6N%z'
|
63
63
|
attr_reader :log
|
64
64
|
|
65
65
|
def configure(conf)
|
@@ -74,10 +74,13 @@ module Fluent::Plugin
|
|
74
74
|
# creates a model for this table
|
75
75
|
table_name = @table
|
76
76
|
primary_key = @primary_key
|
77
|
+
time_format = @time_format
|
78
|
+
|
77
79
|
@model = Class.new(base_model) do
|
78
80
|
self.table_name = table_name
|
79
81
|
self.inheritance_column = '_never_use_'
|
80
82
|
self.primary_key = primary_key if primary_key
|
83
|
+
self.const_set(:TIME_FORMAT, time_format)
|
81
84
|
|
82
85
|
#self.include_root_in_json = false
|
83
86
|
|
@@ -86,7 +89,7 @@ module Fluent::Plugin
|
|
86
89
|
if v.respond_to?(:to_msgpack)
|
87
90
|
v
|
88
91
|
elsif v.is_a? Time
|
89
|
-
v.strftime(
|
92
|
+
v.strftime(self.class::TIME_FORMAT)
|
90
93
|
else
|
91
94
|
v.to_s
|
92
95
|
end
|
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: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|