fluent-plugin-redshift 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_redshift.rb +5 -2
- data/test/plugin/test_out_redshift.rb +14 -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: 2b88c3334997e74901efda542d441ee184e6fba6
|
4
|
+
data.tar.gz: ddaf48cb0097b54d1232057d17f6e2b80f1d6675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e72f127433af970ac505de35235e0879eb9390f1bf3b43e20fea896d54ed25347071efd6b42e769bf7e77525e49355f7b085c43f9fbad5c464afd0182c02a5a
|
7
|
+
data.tar.gz: 082a35783e38b79f31a216ef01a3625e6c492d007f58b186a0edad1a4dcae8c1fba72a9c5bfa850f9089937aab86974cafb797ccf34b9e2acfa3733d7a6de093
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -64,7 +64,7 @@ DESC
|
|
64
64
|
Schema name to store data. By default, this option is not
|
65
65
|
Set and find table without schema as your own search_path.
|
66
66
|
DESC
|
67
|
-
config_param :redshift_copy_base_options, :string , :default => "FILLRECORD ACCEPTANYDATE TRUNCATECOLUMNS"
|
67
|
+
config_param :redshift_copy_base_options, :string , :default => "ESCAPE FILLRECORD ACCEPTANYDATE TRUNCATECOLUMNS"
|
68
68
|
config_param :redshift_copy_options, :string , :default => nil
|
69
69
|
config_param :redshift_connect_timeout, :integer, :default => 10,
|
70
70
|
:desc => "Maximum time to wait for connection to succeed."
|
@@ -214,7 +214,10 @@ DESC
|
|
214
214
|
else
|
215
215
|
"CREDENTIALS 'aws_iam_role=#{@aws_iam_role}'"
|
216
216
|
end
|
217
|
-
|
217
|
+
escape = if !@redshift_copy_base_options.include?('ESCAPE') && (json? || msgpack?)
|
218
|
+
" ESCAPE"
|
219
|
+
end
|
220
|
+
"copy #{@table_name_with_schema}#{copy_columns} from '%s' #{credentials} delimiter '#{@delimiter}' GZIP#{escape} #{@redshift_copy_base_options} #{@redshift_copy_options};"
|
218
221
|
end
|
219
222
|
|
220
223
|
|
@@ -107,13 +107,14 @@ class RedshiftOutputTest < Test::Unit::TestCase
|
|
107
107
|
assert_equal "test_password", d.instance.redshift_password
|
108
108
|
assert_equal "test_table", d.instance.redshift_tablename
|
109
109
|
assert_equal nil, d.instance.redshift_schemaname
|
110
|
-
assert_equal "FILLRECORD ACCEPTANYDATE TRUNCATECOLUMNS", d.instance.redshift_copy_base_options
|
110
|
+
assert_equal "ESCAPE FILLRECORD ACCEPTANYDATE TRUNCATECOLUMNS", d.instance.redshift_copy_base_options
|
111
111
|
assert_equal nil, d.instance.redshift_copy_options
|
112
112
|
assert_equal "csv", d.instance.file_type
|
113
113
|
assert_equal ",", d.instance.delimiter
|
114
114
|
assert_equal true, d.instance.utc
|
115
115
|
assert_equal MAINTENANCE_FILE_PATH_FOR_TEST, d.instance.maintenance_file_path
|
116
116
|
assert_equal nil, d.instance.redshift_copy_columns
|
117
|
+
assert_equal true, d.instance.instance_variable_get("@copy_sql_template").include?('ESCAPE')
|
117
118
|
end
|
118
119
|
def test_configure_with_schemaname
|
119
120
|
d = create_driver(CONFIG_JSON_WITH_SCHEMA)
|
@@ -147,16 +148,28 @@ class RedshiftOutputTest < Test::Unit::TestCase
|
|
147
148
|
d1 = create_driver(CONFIG_TSV)
|
148
149
|
assert_equal "tsv", d1.instance.file_type
|
149
150
|
assert_equal "\t", d1.instance.delimiter
|
151
|
+
assert_equal true, d1.instance.instance_variable_get("@copy_sql_template").include?('ESCAPE')
|
152
|
+
end
|
153
|
+
def test_configure_tsv_without_copy_escape
|
154
|
+
d1 = create_driver(CONFIG_TSV + "\n redshift_copy_base_options FILLRECORD ACCEPTANYDATE TRUNCATECOLUMNS")
|
155
|
+
assert_equal false, d1.instance.instance_variable_get("@copy_sql_template").include?('ESCAPE')
|
150
156
|
end
|
151
157
|
def test_configure_json
|
152
158
|
d2 = create_driver(CONFIG_JSON)
|
153
159
|
assert_equal "json", d2.instance.file_type
|
154
160
|
assert_equal "\t", d2.instance.delimiter
|
161
|
+
assert_match /^copy test_table.*ESCAPE.*/, d2.instance.instance_variable_get("@copy_sql_template")
|
162
|
+
end
|
163
|
+
def test_configure_json_without_copy_escape
|
164
|
+
d1 = create_driver(CONFIG_JSON + "\n redshift_copy_base_options FILLRECORD ACCEPTANYDATE TRUNCATECOLUMNS")
|
165
|
+
# It should add ESCAPE option since json value is escaped anyway by our code
|
166
|
+
assert_equal true, d1.instance.instance_variable_get("@copy_sql_template").include?('ESCAPE')
|
155
167
|
end
|
156
168
|
def test_configure_msgpack
|
157
169
|
d2 = create_driver(CONFIG_MSGPACK)
|
158
170
|
assert_equal "msgpack", d2.instance.file_type
|
159
171
|
assert_equal "\t", d2.instance.delimiter
|
172
|
+
assert_match /^copy test_table.*ESCAPE.*/, d2.instance.instance_variable_get("@copy_sql_template")
|
160
173
|
end
|
161
174
|
def test_configure_original_file_type
|
162
175
|
d3 = create_driver(CONFIG_PIPE_DELIMITER)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-redshift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masashi Miyazaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|