embulk-filter-query_string_ruby 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/embulk-filter-query_string_ruby.gemspec +1 -1
- data/lib/embulk/filter/query_string_ruby.rb +24 -17
- 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: eee2562738fdd2b055730f0d52aa27615f793e1b
|
4
|
+
data.tar.gz: f71da22947098595d3a2205969ea445d799d86ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc30a1cda9076f1fc8d898fe886a472863cce64170a757f21b1e0e434fc827d99e904808f7921f7deffd0393823360f5f9e3faf004b5ee8a30272e5bbf6c39b
|
7
|
+
data.tar.gz: 355a4b6d38f97f41dc5d8ec79f00313c231d32ffb025d03b2f103dd46fbb3ac2206c02d775b1426a6ee1e26529896265a04715d3ef60c893e0d9a22ee0d9de04
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "embulk-filter-query_string_ruby"
|
4
|
-
spec.version = "0.1.
|
4
|
+
spec.version = "0.1.9"
|
5
5
|
spec.authors = ["Yuma Murata"]
|
6
6
|
spec.summary = "Query String Ruby filter plugin for Embulk"
|
7
7
|
spec.description = "Query String Ruby"
|
@@ -39,29 +39,36 @@ module Embulk
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def query_parser(query_string)
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
begin
|
43
|
+
u = Addressable::URI.parse(query_string)
|
44
|
+
uri = u.query ? u : Addressable::URI.parse("?#{query_string}")
|
45
|
+
return uri.query_values(Hash)
|
46
|
+
rescue => e
|
47
|
+
Embulk.logger.warn("Parse failed '#{query_string}'")
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
def make_record(schema, query)
|
48
52
|
return schema.map do |col|
|
49
53
|
v = query[col["name"]]
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
|
55
|
+
if v.to_s.empty?
|
56
|
+
next
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
case col["type"]
|
61
|
+
when "long"
|
62
|
+
Integer(v)
|
63
|
+
when "double"
|
64
|
+
Float(v)
|
65
|
+
when "timestamp"
|
66
|
+
Time.parse(v)
|
67
|
+
else
|
68
|
+
v.to_s
|
64
69
|
end
|
70
|
+
rescue => e
|
71
|
+
Embulk.logger.warn("Cast failed '#{v}' as '#{col["type"]}' (query name is '#{col["name"]}')")
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-query_string_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuma Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|