embulk-filter-mysql_lookup 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 986a3e18c5daf7eeda74e5d4f1b32a047cdf0b817317ce43c66db91a932ea7e6
4
- data.tar.gz: 7e6dea6395cdcd22e93d950a2c50b9f38eb955285680c2be2e10576208f5e49b
3
+ metadata.gz: b21673bee3d44790b92f529c7e231d0d59d5a840b9333969036cb54692273294
4
+ data.tar.gz: 785a6ed85c5ed162116f643a32fa7912fbbfd5df28e47578e8723bf35f77356d
5
5
  SHA512:
6
- metadata.gz: 8e23daedc484493ebfb0c75a97ac731893a84db3b397587f626c2e4b2553230c86e9896c3e3e4ef6ba0aee8738a5a1ebb031af093023c71e9e5d8dd30854e82a
7
- data.tar.gz: 3e688f47128c722364d080f4993a67ce52531654ed0898690374bf064f979607da10a788cde5012145a45469f031e6a97d928c17a6dd3ce029f97aa3c0d24788
6
+ metadata.gz: 4d414ef92f46c1ff72dd0dd38a385d06e0854f722fdfec3442f906e950f5b78626c186ed79d030305bfb208062f11a8f1e81b0138abce7ba8c7e5b2f505c5b8d
7
+ data.tar.gz: 87bec41710718ee63d33659e204d7925387277ab83c9405972a33b614649bcb2d2125143112bc1a1a293721ee69b73a345ace1710ff89b5a75bcb6758f6a6b93
data/.gitignore CHANGED
@@ -1,12 +1,12 @@
1
- *~
2
- /pkg/
3
- /tmp/
4
- *.gemspec
5
- .gradle/
6
- /classpath/
7
- build/
8
- .idea
9
- /.settings/
10
- /.metadata/
11
- .classpath
12
- .project
1
+ *~
2
+ /pkg/
3
+ /tmp/
4
+ *.gemspec
5
+ .gradle/
6
+ /classpath/
7
+ build/
8
+ .idea
9
+ /.settings/
10
+ /.metadata/
11
+ .classpath
12
+ .project
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 InfoObjects Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2022 InfoObjects Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
data/README.md CHANGED
@@ -1,144 +1,148 @@
1
- <p align="center">
2
- <a href="https://www.infoobjects.com/" target="blank"><img src="screenshots/logo.png" width="150" alt="InfoObjects Logo" /></a>
3
- </p>
4
- <p align="center">Infoobjects is a consulting company that helps enterprises transform how and where they run applications and infrastructure.
5
- From strategy, to implementation, to ongoing managed services, Infoobjects creates tailored cloud solutions for enterprises at all stages of the cloud journey.</p>
6
-
7
- # MYSQL lookup filter plugin for Embulk
8
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
-
10
-
11
- An Embulk filter plugin for Lookup Transformation with MySQL database
12
-
13
- ## Configuration
14
-
15
- - **mysql_lookup**: Required attributes for the LookUp Filter Plugin -
16
- - **host**: database host (example `localhost`) (required)
17
- - **port**: database port (example port for mssql `1433`) (required
18
- - **database**: database name (required)
19
- - **table_name**: table name of your database (required)
20
- - **username**: username for your database (required)
21
- - **password**: password for database (required)
22
- - **mapping_from**: (Name of columns to be matched with table 2 columns) (required)
23
- - **Name of column-1**: column name-1 from input file
24
- - **Name of column-2**: column name-2 from input file etc ...
25
- - **mapping_to**: (Name of columns to be matched with table 1 columns) (required)
26
- - **Name of column-1**: column name-1 from input file
27
- - **Name of column-2**: column name-2 from input file
28
- - **new_columns**: (New generated column names) (required)
29
- - **Name-1,Type-1**: Any Name, Type of the name (name: country_name, type: string)
30
- - **Name-2,Type-2**: Any Name, Type of the name (name: country_address, type: string) etc ...
31
- ## Example - columns
32
-
33
- Input1 for table 1 is as follows :-
34
-
35
- ```
36
- year country_code country_name literacy_rate
37
-
38
- 1990 1 India 80%
39
- 1993 2 USA 83%
40
- 1997 3 JAPAN
41
- 1999 4 China 72%
42
- 2000 5 Ukraine 68%
43
- 2002 6 Italy 79%
44
- 2004 7 UK 75%
45
- 2011 8 NULL 42%
46
- ```
47
-
48
- Input2 for table 2 is as follows :-
49
-
50
- ```
51
- id country_population country_address country_GDP
52
-
53
- 1 11.3 India 1.67
54
- 2 18.2 USA 16.72
55
- 3 30 JAPAN 5.00
56
- 4 4 China 9.33
57
- 5 57 Ukraine 1.08
58
- 6 63 Italy 2.068
59
- 7 17 UK 2.49
60
- 8 28 UAE 1.18
61
-
62
-
63
- Note: country_population is calculated in Billion and country_GDP is calculated in $USD Trillion
64
- ```
65
-
66
- As shown in yaml below, columns mentioned in mapping_from will be mapped with columns mentioned in mapping_to
67
- ie:
68
-
69
-
70
- country_code : id
71
- country_name : country_address
72
-
73
- After successful mapping an Output.csv file containing the columns mentioned in new_columns will be generated
74
-
75
-
76
-
77
- Output File generated :-
78
-
79
- ```
80
- year country_code country_name literacy_rate country_GDP country_population
81
-
82
- 1990 1 India 80% 1.67 11.3
83
- 1993 2 USA 83% 16.72 18.2
84
- 1997 3 JAPAN 5.00 30
85
- 1999 4 China 72% 9.33 4
86
- 2000 5 Ukraine 68% 1.08 57
87
- 2002 6 Italy 79% 2.068 63
88
- 2004 7 UK 75% 2.49 17
89
- 2011 8 NULL 42%
90
- ```
91
-
92
-
93
-
94
- ```yaml
95
- - type: mysql_lookup
96
- host: localhost
97
- port: 1433
98
- database: test
99
- tablename: country_details
100
- username: root
101
- password: root
102
- mapping_from:
103
- - country_code
104
- - country_name
105
- mapping_to:
106
- - id
107
- - country_address
108
- new_columns:
109
- - { name: country_GDP, type: string }
110
- - { name: country_population, type: string }
111
- ```
112
-
113
- Notes:
114
- 1. mapping_from attribute should be in same order as mentioned in input file.
115
-
116
- ## Development
117
-
118
- Run example:
119
-
120
- ```
121
- $ ./gradlew package
122
- $ embulk run -I ./lib seed.yml
123
- ```
124
-
125
- Deployment Steps:
126
-
127
- ```
128
- Install ruby in your machine
129
- $ gem install gemcutter (For windows OS)
130
-
131
- $ ./gradlew gemPush
132
- $ gem build NameOfYourPlugins (example: embulk-filter-mssql_lookup)
133
- $ gem push embulk-filter-mssql_lookup-0.1.0.gem (You will get this name after running above command)
134
- ```
135
-
136
-
137
- Release gem:
138
-
139
- ```
140
- $ ./gradlew gemPush
141
- ```
142
- ## Licensing
143
-
1
+ <p align="center">
2
+ <a href="https://www.infoobjects.com/" target="blank"><img src="screenshots/logo.png" width="150" alt="InfoObjects Logo" /></a>
3
+ </p>
4
+ <p align="center">Infoobjects is a consulting company that helps enterprises transform how and where they run applications and infrastructure.
5
+ From strategy, to implementation, to ongoing managed services, Infoobjects creates tailored cloud solutions for enterprises at all stages of the cloud journey.</p>
6
+
7
+ # MYSQL lookup filter plugin for Embulk
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+
10
+
11
+ An Embulk filter plugin for Lookup Transformation with MySQL database
12
+
13
+ ## Configuration
14
+
15
+ - **mysql_lookup**: Required attributes for the LookUp Filter Plugin -
16
+ - **filters**:
17
+ - **type**: Name of lookup type (required)
18
+ - **driver_path**: path to the jar file of the MySQL JDBC driver. If not set, the bundled JDBC driver (MySQL Connector/J 8.0.19) will be used (string)
19
+ - **driver_class**: Here we can provide driver class name,if not set,the com.mysql.cj.jdbc.Driver class will be used
20
+ - **host**: database host (example `localhost`) (required)
21
+ - **port**: database port (example port for mssql `1433`) (required
22
+ - **database**: database name (required)
23
+ - **table_name**: table name of your database (required)
24
+ - **username**: username for your database (required)
25
+ - **password**: password for database (required)
26
+ - **mapping_from**: (Name of columns to be matched with table 2 columns) (required)
27
+ - **Name of column-1**: column name-1 from input file
28
+ - **Name of column-2**: column name-2 from input file etc ...
29
+ - **mapping_to**: (Name of columns to be matched with table 1 columns) (required)
30
+ - **Name of column-1**: column name-1 from input file
31
+ - **Name of column-2**: column name-2 from input file
32
+ - **new_columns**: (New generated column names) (required)
33
+ - **Name-1,Type-1**: Any Name, Type of the name (name: country_name, type: string)
34
+ - **Name-2,Type-2**: Any Name, Type of the name (name: country_address, type: string) etc ...
35
+ ## Example - columns
36
+
37
+ Input1 for table 1 is as follows :-
38
+
39
+ ```
40
+ year country_code country_name literacy_rate
41
+
42
+ 1990 1 India 80%
43
+ 1993 2 USA 83%
44
+ 1997 3 JAPAN
45
+ 1999 4 China 72%
46
+ 2000 5 Ukraine 68%
47
+ 2002 6 Italy 79%
48
+ 2004 7 UK 75%
49
+ 2011 8 NULL 42%
50
+ ```
51
+
52
+ Input2 for table 2 is as follows :-
53
+
54
+ ```
55
+ id country_population country_address country_GDP
56
+
57
+ 1 11.3 India 1.67
58
+ 2 18.2 USA 16.72
59
+ 3 30 JAPAN 5.00
60
+ 4 4 China 9.33
61
+ 5 57 Ukraine 1.08
62
+ 6 63 Italy 2.068
63
+ 7 17 UK 2.49
64
+ 8 28 UAE 1.18
65
+
66
+
67
+ Note: country_population is calculated in Billion and country_GDP is calculated in $USD Trillion
68
+ ```
69
+
70
+ As shown in yaml below, columns mentioned in mapping_from will be mapped with columns mentioned in mapping_to
71
+ ie:
72
+
73
+
74
+ country_code : id
75
+ country_name : country_address
76
+
77
+ After successful mapping an Output.csv file containing the columns mentioned in new_columns will be generated
78
+
79
+
80
+
81
+ Output File generated :-
82
+
83
+ ```
84
+ year country_code country_name literacy_rate country_GDP country_population
85
+
86
+ 1990 1 India 80% 1.67 11.3
87
+ 1993 2 USA 83% 16.72 18.2
88
+ 1997 3 JAPAN 5.00 30
89
+ 1999 4 China 72% 9.33 4
90
+ 2000 5 Ukraine 68% 1.08 57
91
+ 2002 6 Italy 79% 2.068 63
92
+ 2004 7 UK 75% 2.49 17
93
+ 2011 8 NULL 42%
94
+ ```
95
+
96
+
97
+
98
+ ```yaml
99
+ - type: mysql_lookup
100
+ host: localhost
101
+ port: 1433
102
+ database: test
103
+ tablename: country_details
104
+ username: root
105
+ password: root
106
+ mapping_from:
107
+ - country_code
108
+ - country_name
109
+ mapping_to:
110
+ - id
111
+ - country_address
112
+ new_columns:
113
+ - { name: country_GDP, type: string }
114
+ - { name: country_population, type: string }
115
+ ```
116
+
117
+ Notes:
118
+ 1. mapping_from attribute should be in same order as mentioned in input file.
119
+
120
+ ## Development
121
+
122
+ Run example:
123
+
124
+ ```
125
+ $ ./gradlew package
126
+ $ embulk run -I ./lib seed.yml
127
+ ```
128
+
129
+ Deployment Steps:
130
+
131
+ ```
132
+ Install ruby in your machine
133
+ $ gem install gemcutter (For windows OS)
134
+
135
+ $ ./gradlew gemPush
136
+ $ gem build NameOfYourPlugins (example: embulk-filter-mssql_lookup)
137
+ $ gem push embulk-filter-mssql_lookup-0.1.0.gem (You will get this name after running above command)
138
+ ```
139
+
140
+
141
+ Release gem:
142
+
143
+ ```
144
+ $ ./gradlew gemPush
145
+ ```
146
+ ## Licensing
147
+
144
148
  InfoObjects [license](LICENSE) (MIT License)
data/build.gradle CHANGED
@@ -1,98 +1,98 @@
1
- plugins {
2
- id "com.jfrog.bintray" version "1.1"
3
- id "com.github.jruby-gradle.base" version "1.5.0"
4
- id "java"
5
- id "checkstyle"
6
- }
7
- import com.github.jrubygradle.JRubyExec
8
- repositories {
9
- mavenCentral()
10
- jcenter()
11
- }
12
- configurations {
13
- provided
14
- }
15
-
16
- version = "0.1.4"
17
-
18
- sourceCompatibility = 1.8
19
- targetCompatibility = 1.8
20
-
21
- dependencies {
22
- compile "org.embulk:embulk-core:0.9.+"
23
- provided "org.embulk:embulk-core:0.9.+"
24
- // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
25
- testCompile "junit:junit:4.+"
26
- compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.19'
27
- }
28
-
29
- task classpath(type: Copy, dependsOn: ["jar"]) {
30
- doFirst { file("classpath").deleteDir() }
31
- from (configurations.runtime - configurations.provided + files(jar.archivePath))
32
- into "classpath"
33
- }
34
- clean { delete "classpath" }
35
-
36
- checkstyle {
37
- configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
38
- toolVersion = '6.14.1'
39
- }
40
- checkstyleMain {
41
- configFile = file("${project.rootDir}/config/checkstyle/default.xml")
42
- ignoreFailures = true
43
- }
44
- checkstyleTest {
45
- configFile = file("${project.rootDir}/config/checkstyle/default.xml")
46
- ignoreFailures = true
47
- }
48
- task checkstyle(type: Checkstyle) {
49
- classpath = sourceSets.main.output + sourceSets.test.output
50
- source = sourceSets.main.allJava + sourceSets.test.allJava
51
- }
52
-
53
- task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
54
- jrubyArgs "-S"
55
- script "gem"
56
- scriptArgs "build", "${project.name}.gemspec"
57
- doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
58
- }
59
-
60
- task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
61
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
62
- script "pkg/${project.name}-${project.version}.gem"
63
- }
64
-
65
- task "package"(dependsOn: ["gemspec", "classpath"]) {
66
- doLast {
67
- println "> Build succeeded."
68
- println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
69
- }
70
- }
71
-
72
- task gemspec {
73
- ext.gemspecFile = file("${project.name}.gemspec")
74
- inputs.file "build.gradle"
75
- outputs.file gemspecFile
76
- doLast { gemspecFile.write($/
77
- Gem::Specification.new do |spec|
78
- spec.name = "${project.name}"
79
- spec.version = "${project.version}"
80
- spec.authors = ["InfoObjects Inc."]
81
- spec.summary = %[An Embulk filter plugin for Lookup Transformation with MySQL database]
82
- spec.description = %[Mysql Lookup filter]
83
- spec.email = ["utkarsh@infoobjects.com"]
84
- spec.licenses = ["MIT"]
85
- spec.homepage = "https://github.com/InfoObjects/embulk-filter-mysql_lookup"
86
-
87
- spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
88
- spec.test_files = spec.files.grep(%r"^(test|spec)/")
89
- spec.require_paths = ["lib"]
90
-
91
- spec.add_development_dependency 'bundler', ['~> 1.0']
92
- spec.add_development_dependency 'rake', ['~> 12.0']
93
- end
94
- /$)
95
- }
96
- }
97
-
98
- clean { delete "${project.name}.gemspec" }
1
+ plugins {
2
+ id "com.jfrog.bintray" version "1.1"
3
+ id "com.github.jruby-gradle.base" version "1.5.0"
4
+ id "java"
5
+ id "checkstyle"
6
+ }
7
+ import com.github.jrubygradle.JRubyExec
8
+ repositories {
9
+ mavenCentral()
10
+ jcenter()
11
+ }
12
+ configurations {
13
+ provided
14
+ }
15
+
16
+ version = "0.1.6"
17
+
18
+ sourceCompatibility = 1.8
19
+ targetCompatibility = 1.8
20
+
21
+ dependencies {
22
+ compile "org.embulk:embulk-core:0.9.+"
23
+ provided "org.embulk:embulk-core:0.9.+"
24
+ // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
25
+ testCompile "junit:junit:4.+"
26
+ compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.19'
27
+ }
28
+
29
+ task classpath(type: Copy, dependsOn: ["jar"]) {
30
+ doFirst { file("classpath").deleteDir() }
31
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
32
+ into "classpath"
33
+ }
34
+ clean { delete "classpath" }
35
+
36
+ checkstyle {
37
+ configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
38
+ toolVersion = '6.14.1'
39
+ }
40
+ checkstyleMain {
41
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
42
+ ignoreFailures = true
43
+ }
44
+ checkstyleTest {
45
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
46
+ ignoreFailures = true
47
+ }
48
+ task checkstyle(type: Checkstyle) {
49
+ classpath = sourceSets.main.output + sourceSets.test.output
50
+ source = sourceSets.main.allJava + sourceSets.test.allJava
51
+ }
52
+
53
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
54
+ jrubyArgs "-S"
55
+ script "gem"
56
+ scriptArgs "build", "${project.name}.gemspec"
57
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
58
+ }
59
+
60
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
61
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
62
+ script "pkg/${project.name}-${project.version}.gem"
63
+ }
64
+
65
+ task "package"(dependsOn: ["gemspec", "classpath"]) {
66
+ doLast {
67
+ println "> Build succeeded."
68
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
69
+ }
70
+ }
71
+
72
+ task gemspec {
73
+ ext.gemspecFile = file("${project.name}.gemspec")
74
+ inputs.file "build.gradle"
75
+ outputs.file gemspecFile
76
+ doLast { gemspecFile.write($/
77
+ Gem::Specification.new do |spec|
78
+ spec.name = "${project.name}"
79
+ spec.version = "${project.version}"
80
+ spec.authors = ["InfoObjects Inc."]
81
+ spec.summary = %[An Embulk filter plugin for Lookup Transformation with MySQL database]
82
+ spec.description = %[Mysql Lookup filter]
83
+ spec.email = ["utkarsh@infoobjects.com"]
84
+ spec.licenses = ["MIT"]
85
+ spec.homepage = "https://github.com/InfoObjects/embulk-filter-mysql_lookup"
86
+
87
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
88
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
89
+ spec.require_paths = ["lib"]
90
+
91
+ spec.add_development_dependency 'bundler', ['~> 1.0']
92
+ spec.add_development_dependency 'rake', ['~> 12.0']
93
+ end
94
+ /$)
95
+ }
96
+ }
97
+
98
+ clean { delete "${project.name}.gemspec" }