embulk-parser-jsonpath 0.3.2-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f8f593d01643c31b479e599071bb78fe9f3eaca9aa4d57365d614eafca4a73e6
4
+ data.tar.gz: 031e9a3a730992a208121053f637adedea546593cba42c789723e80eb754b5cc
5
+ SHA512:
6
+ metadata.gz: 8d997d8b6e0f41754ce197b54e210e87080b630b34fac1a35cb55e310db62e182d3efc8752a4da781f353c5be5d66ed1503210e821e65a02ef8ccac11e220a10
7
+ data.tar.gz: 19b6103582135190b51bf5d3770f5ac831e40bbfeffc8c79a8ca562f0e46c261a36d5b219845eac224eed6b5f763458a90ba6d50fc38ab6e8d7807116618959a
Binary file
@@ -0,0 +1,31 @@
1
+ require 'json'
2
+ require 'jsonpath'
3
+ module Embulk
4
+ module Guess
5
+
6
+ class Jsonpath < TextGuessPlugin
7
+ Plugin.register_guess("jsonpath", self)
8
+
9
+ def guess_text(config, sample_text)
10
+ parser_config = config.param("parser",:hash)
11
+ json_path = parser_config.param("root",:string,default: "$")
12
+ json = JsonPath.new(json_path).on(sample_text).first
13
+ if( json.kind_of?(Array) )
14
+ no_hash = json.find{ |j| !j.kind_of?(Hash) }
15
+ raise RuntimeError,"Can't exec guess. The row data must be hash." if no_hash
16
+ columns = Embulk::Guess::SchemaGuess.from_hash_records(json).map do |c|
17
+ column = {name: c.name, type: c.type}
18
+ column[:format] = c.format if c.format
19
+ column
20
+ end
21
+ parser_guessed = {"type" => "jsonpath"}
22
+ parser_guessed["columns"] = columns
23
+ return {"parser" => parser_guessed}
24
+ else
25
+ raise RuntimeError,"Can't guess specified the JSONPath: #{json_path}. The results does not return an Array."
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ Embulk::JavaPlugin.register_parser(
2
+ "jsonpath", "org.embulk.parser.jsonpath.JsonpathParserPlugin",
3
+ File.expand_path('../../../../classpath', __FILE__))
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: embulk-parser-jsonpath
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
+ platform: java
6
+ authors:
7
+ - Hiroyuki Sato
8
+ - Takuma kanari
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2020-07-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.5'
20
+ name: jsonpath
21
+ prerelease: false
22
+ type: :runtime
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.5'
28
+ - !ruby/object:Gem::Dependency
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ name: json
35
+ prerelease: false
36
+ type: :runtime
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '2.0'
42
+ description: Parses JSON files with JSONPath read by other file input plugins.
43
+ email:
44
+ - hiroysato@gmail.com
45
+ - chemtrails.t@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - classpath/accessors-smart-1.2.jar
51
+ - classpath/asm-5.0.4.jar
52
+ - classpath/embulk-parser-jsonpath-0.3.2.jar
53
+ - classpath/json-path-2.4.0.jar
54
+ - classpath/json-smart-2.3.jar
55
+ - lib/embulk/guess/jsonpath.rb
56
+ - lib/embulk/parser/jsonpath.rb
57
+ homepage: https://github.com/hiroyuki-sato/embulk-parser-jsonpath
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.7.9
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: JSON parser with JSONPath plugin for Embulk
81
+ test_files: []