kiba 2.0.0.rc1 → 2.0.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/Changes.md +2 -2
- data/README.md +35 -2
- data/lib/kiba/version.rb +1 -1
- data/test/support/test_duplicate_row_transform.rb +9 -0
- data/test/test_streaming_runner.rb +16 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f048352971676a1a1a3f29e1e2e13b7784a10022
|
4
|
+
data.tar.gz: 04dbac7b41da880e759356186fbf813beff621d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bbba96a440dba7fc7a41e2c55a2bd063bf1a8ad71c17c9a8ab9832be5aaa1c07b459c2db340b2adc489cb329f0e91c807fa73ca3442a66cc4c8fc62627627e3
|
7
|
+
data.tar.gz: 79ddd85e029eb1185610a7f2c59b8a39b093bb9ab318d2aae3cdd55e9493e62b724273e126f6681c8aa823e005a6f20ee4cfc07eec834e0671eb412d71978b12
|
data/Changes.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
2.0.0.rc1
|
2
|
-
|
1
|
+
2.0.0.rc1
|
2
|
+
---------
|
3
3
|
|
4
4
|
- New (opt-in) StreamingRunner allows class transforms to generate more than one row. See [#44](https://github.com/thbar/kiba/pull/44) for rationale & how to activate.
|
5
5
|
- Potentially breaking change if you were using the internal class `Kiba::Parser` directly: ETL jobs parsing has been modified to improve the isolation between the evaluation scope and the Kiba classes. See [#46](https://github.com/thbar/kiba/pull/46) for more information.
|
data/README.md
CHANGED
@@ -9,9 +9,42 @@ Learn more on the [Wiki](https://github.com/thbar/kiba/wiki), on my [blog](http:
|
|
9
9
|
[](http://badge.fury.io/rb/kiba)
|
10
10
|
[](https://travis-ci.org/thbar/kiba) [](https://ci.appveyor.com/project/thbar/kiba) [](https://codeclimate.com/github/thbar/kiba) [](https://gemnasium.com/thbar/kiba)
|
11
11
|
|
12
|
-
##
|
12
|
+
## Kiba 2.0.0.rc1
|
13
13
|
|
14
|
-
Kiba 2.0.0 (available
|
14
|
+
Kiba 2.0.0.rc1 (available via `gem install kiba --prerelease`) is available for testing.
|
15
|
+
|
16
|
+
### New StreamingRunner engine
|
17
|
+
|
18
|
+
Kiba 2 introduces a new, opt-in engine called the `StreamingRunner`, which allows to generate an arbitrary number of rows inside transforms. This drastically improves the reusability & composability of Kiba components (see [#44](https://github.com/thbar/kiba/pull/44) for some background).
|
19
|
+
|
20
|
+
To use the `StreamingRunner`, use the following code:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# activate the new Kiba internal config system
|
24
|
+
extend Kiba::DSLExtensions::Config
|
25
|
+
# opt-in for the new engine
|
26
|
+
config :kiba, runner: Kiba::StreamingRunner
|
27
|
+
|
28
|
+
# write transform class able to yield an arbitrary number of rows
|
29
|
+
class MyYieldingTransform
|
30
|
+
def process(row)
|
31
|
+
yield {key: 1}
|
32
|
+
yield {key: 2}
|
33
|
+
{key: 3}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
The improved runner is compatible with Ruby 2.0+.
|
39
|
+
|
40
|
+
### Compatibility with Kiba 1
|
41
|
+
|
42
|
+
Kiba 2 is expected to be compatible with existing Kiba scripts as long as you did not use internal API.
|
43
|
+
|
44
|
+
Internal changes include:
|
45
|
+
|
46
|
+
* An opt-in, Elixir's mix-inspired `config` system, currently only used to select the runner you want at job declaration time
|
47
|
+
* A stronger isolation in the `Parser`, to reduces the chances that ETL scripts could conflict with Kiba internal classes
|
15
48
|
|
16
49
|
## Getting Started
|
17
50
|
|
data/lib/kiba/version.rb
CHANGED
@@ -2,6 +2,8 @@ require_relative 'helper'
|
|
2
2
|
require_relative 'support/test_enumerable_source'
|
3
3
|
require_relative 'support/test_array_destination'
|
4
4
|
require_relative 'support/test_yielding_transform'
|
5
|
+
require_relative 'support/test_duplicate_row_transform'
|
6
|
+
|
5
7
|
require_relative 'common/runner'
|
6
8
|
|
7
9
|
class TestStreamingRunner < Kiba::Test
|
@@ -16,8 +18,15 @@ class TestStreamingRunner < Kiba::Test
|
|
16
18
|
|
17
19
|
config :kiba, runner: Kiba::StreamingRunner
|
18
20
|
|
21
|
+
# provide a single row as the input
|
19
22
|
source TestEnumerableSource, [input_row]
|
23
|
+
|
24
|
+
# explode tags in one row each
|
20
25
|
transform TestYieldingTransform
|
26
|
+
|
27
|
+
# generate two rows out of each exploded tags row
|
28
|
+
transform TestDuplicateRowTranform
|
29
|
+
|
21
30
|
destination TestArrayDestination, destination_array
|
22
31
|
end
|
23
32
|
|
@@ -25,8 +34,15 @@ class TestStreamingRunner < Kiba::Test
|
|
25
34
|
|
26
35
|
assert_equal [
|
27
36
|
{item: 'one'},
|
37
|
+
{item: 'one'},
|
38
|
+
|
39
|
+
{item: 'two'},
|
28
40
|
{item: 'two'},
|
41
|
+
|
29
42
|
{item: 'three'},
|
43
|
+
{item: 'three'},
|
44
|
+
|
45
|
+
{item: 'classic-return-value'},
|
30
46
|
{item: 'classic-return-value'}
|
31
47
|
], destination_array
|
32
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kiba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaut Barrère
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- test/support/test_array_destination.rb
|
105
105
|
- test/support/test_csv_destination.rb
|
106
106
|
- test/support/test_csv_source.rb
|
107
|
+
- test/support/test_duplicate_row_transform.rb
|
107
108
|
- test/support/test_enumerable_source.rb
|
108
109
|
- test/support/test_rename_field_transform.rb
|
109
110
|
- test/support/test_source_that_reads_at_instantiation_time.rb
|
@@ -129,9 +130,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
130
|
version: '0'
|
130
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
132
|
requirements:
|
132
|
-
- - "
|
133
|
+
- - ">="
|
133
134
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
135
|
+
version: '0'
|
135
136
|
requirements: []
|
136
137
|
rubyforge_project:
|
137
138
|
rubygems_version: 2.6.14
|
@@ -149,6 +150,7 @@ test_files:
|
|
149
150
|
- test/support/test_array_destination.rb
|
150
151
|
- test/support/test_csv_destination.rb
|
151
152
|
- test/support/test_csv_source.rb
|
153
|
+
- test/support/test_duplicate_row_transform.rb
|
152
154
|
- test/support/test_enumerable_source.rb
|
153
155
|
- test/support/test_rename_field_transform.rb
|
154
156
|
- test/support/test_source_that_reads_at_instantiation_time.rb
|