activewarehouse-etl 0.9.5.rc1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.standalone_migrations +2 -0
- data/.travis.yml +15 -0
- data/CHANGELOG +10 -1
- data/HOW_TO_RELEASE +4 -0
- data/LICENSE +1 -1
- data/README.textile +111 -0
- data/Rakefile +37 -78
- data/activewarehouse-etl.gemspec +7 -4
- data/db/migrate/20120229203554_create_tables.rb +37 -0
- data/db/schema.rb +45 -0
- data/examples/database.example.yml +3 -3
- data/lib/etl.rb +16 -0
- data/lib/etl/commands/etl.rb +1 -0
- data/lib/etl/control/control.rb +1 -1
- data/lib/etl/control/destination.rb +5 -16
- data/lib/etl/control/destination/csv_destination.rb +122 -0
- data/lib/etl/control/destination/excel_destination.rb +1 -1
- data/lib/etl/control/destination/insert_update_database_destination.rb +6 -3
- data/lib/etl/control/destination/yaml_destination.rb +74 -0
- data/lib/etl/control/source.rb +39 -4
- data/lib/etl/control/source/database_source.rb +6 -1
- data/lib/etl/control/source/file_source.rb +4 -0
- data/lib/etl/control/source/mysql_streamer.rb +31 -0
- data/lib/etl/engine.rb +40 -20
- data/lib/etl/parser/{delimited_parser.rb → csv_parser.rb} +3 -3
- data/lib/etl/parser/excel_parser.rb +1 -1
- data/lib/etl/parser/nokogiri_xml_parser.rb +83 -0
- data/lib/etl/processor/bulk_import_processor.rb +11 -0
- data/lib/etl/processor/check_exist_processor.rb +6 -6
- data/lib/etl/processor/check_unique_processor.rb +4 -0
- data/lib/etl/processor/database_join_processor.rb +25 -4
- data/lib/etl/processor/encode_processor.rb +0 -2
- data/lib/etl/processor/ensure_fields_presence_processor.rb +24 -0
- data/lib/etl/processor/imapattachment_downloader_processor.rb +2 -2
- data/lib/etl/processor/pop3attachment_downloader_processor.rb +2 -2
- data/lib/etl/processor/row_processor.rb +10 -0
- data/lib/etl/processor/sftp_downloader_processor.rb +1 -1
- data/lib/etl/processor/sftp_uploader_processor.rb +1 -1
- data/lib/etl/processor/truncate_processor.rb +4 -1
- data/lib/etl/processor/zip_file_processor.rb +1 -1
- data/lib/etl/transform/foreign_key_lookup_transform.rb +57 -15
- data/lib/etl/transform/md5_transform.rb +13 -0
- data/lib/etl/transform/{string_to_datetime_transform.rb → string_to_date_time_transform.rb} +0 -0
- data/lib/etl/version.rb +1 -1
- data/test/.gitignore +0 -1
- data/test/check_exist_processor_test.rb +89 -0
- data/test/check_unique_processor_test.rb +40 -0
- data/test/config/.gitignore +1 -0
- data/test/config/database.yml +28 -0
- data/test/config/{Gemfile.rails-3.0.x → gemfiles/Gemfile.rails-3.0.x} +1 -1
- data/test/config/{Gemfile.rails-2.3.x → gemfiles/Gemfile.rails-3.1.x} +1 -1
- data/test/config/gemfiles/Gemfile.rails-3.2.x +3 -0
- data/test/config/gemfiles/common.rb +29 -0
- data/test/control_test.rb +2 -2
- data/test/data/nokogiri.xml +38 -0
- data/test/database_join_processor_test.rb +43 -0
- data/test/delimited.ctl +1 -1
- data/test/delimited_absolute.ctl +1 -3
- data/test/delimited_destination_db.ctl +1 -3
- data/test/delimited_excel.ctl +1 -1
- data/test/delimited_insert_update.ctl +1 -1
- data/test/delimited_update.ctl +1 -1
- data/test/delimited_with_bulk_load.ctl +2 -2
- data/test/destination_test.rb +0 -4
- data/test/encode_processor_test.rb +2 -0
- data/test/engine_test.rb +65 -19
- data/test/ensure_fields_presence_processor_test.rb +33 -0
- data/test/foreign_key_lookup_transform_test.rb +50 -0
- data/test/multiple_delimited.ctl +1 -1
- data/test/multiple_source_delimited.ctl +2 -2
- data/test/nokogiri_all.ctl +35 -0
- data/test/nokogiri_select.ctl +35 -0
- data/test/nokogiri_test.rb +35 -0
- data/test/parser_test.rb +2 -2
- data/test/performance/delimited.ctl +1 -1
- data/test/processor_test.rb +0 -3
- data/test/scd_test.rb +2 -8
- data/test/scd_test_type_1.ctl +1 -1
- data/test/scd_test_type_2.ctl +1 -1
- data/test/screen_test.rb +2 -3
- data/test/source_test.rb +19 -6
- data/test/test_helper.rb +6 -8
- data/test/truncate_processor_test.rb +37 -0
- metadata +121 -144
- data/README +0 -101
- data/active_support_logger.patch +0 -78
- data/test-matrix.yml +0 -10
- data/test/config/Gemfile.rails-2.3.x.lock +0 -38
- data/test/config/Gemfile.rails-3.0.x.lock +0 -49
- data/test/config/common.rb +0 -21
- data/test/connection/mysql/connection.rb +0 -9
- data/test/connection/mysql/schema.sql +0 -36
- data/test/connection/postgresql/connection.rb +0 -13
- data/test/connection/postgresql/schema.sql +0 -39
- data/test/vendor/adapter_extensions-0.5.0/CHANGELOG +0 -26
- data/test/vendor/adapter_extensions-0.5.0/LICENSE +0 -16
- data/test/vendor/adapter_extensions-0.5.0/README +0 -7
- data/test/vendor/adapter_extensions-0.5.0/Rakefile +0 -158
- data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions.rb +0 -12
- data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/abstract_adapter.rb +0 -44
- data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/mysql_adapter.rb +0 -63
- data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/postgresql_adapter.rb +0 -52
- data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/sqlserver_adapter.rb +0 -44
- data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/version.rb +0 -10
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class EnsureFieldsPresenceProcessorTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def new_processor(options)
|
6
|
+
ETL::Processor::EnsureFieldsPresenceProcessor.new(nil, options)
|
7
|
+
end
|
8
|
+
|
9
|
+
should 'raise an error unless :fields is specified' do
|
10
|
+
error = assert_raises(ETL::ControlError) { new_processor({}) }
|
11
|
+
assert_equal ":fields must be specified", error.message
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'raise an error if a field is missing in the row' do
|
15
|
+
error = assert_raise(ETL::ControlError) do
|
16
|
+
processor = new_processor(:fields => [:key])
|
17
|
+
processor.process(ETL::Row[])
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_match /missing required field\(s\)/, error.message
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'return the row if the required fields are in the row' do
|
24
|
+
row = ETL::Row[:first => nil, :second => "Barry"]
|
25
|
+
assert_equal row, new_processor(:fields => [:first, :second]).process(row)
|
26
|
+
end
|
27
|
+
|
28
|
+
should 'accept strings instead of symbols in both places' do
|
29
|
+
row = ETL::Row[:first => nil, 'second' => "Barry"]
|
30
|
+
assert_equal row, new_processor(:fields => ['first', :second]).process(row)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
# TODO - use flexmock instead, but I'm not sure how to handle the respond_to part yet
|
4
|
+
class TestResolver
|
5
|
+
attr_accessor :cache_loaded
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@cache_loaded = false
|
9
|
+
end
|
10
|
+
|
11
|
+
def load_cache
|
12
|
+
@cache_loaded = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class ForeignKeyLookupTransformTest < Test::Unit::TestCase
|
17
|
+
|
18
|
+
context 'configuration' do
|
19
|
+
|
20
|
+
should 'enable cache by default' do
|
21
|
+
resolver = TestResolver.new
|
22
|
+
|
23
|
+
transform = ETL::Transform::ForeignKeyLookupTransform.new(nil, 'name',
|
24
|
+
{:resolver => resolver})
|
25
|
+
|
26
|
+
assert_equal true, resolver.cache_loaded
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'allow to disable cache' do
|
30
|
+
resolver = TestResolver.new
|
31
|
+
|
32
|
+
transform = ETL::Transform::ForeignKeyLookupTransform.new(nil, 'name',
|
33
|
+
{:resolver => resolver, :cache => false})
|
34
|
+
|
35
|
+
assert_equal false, resolver.cache_loaded
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'allow to enable cache' do
|
39
|
+
resolver = TestResolver.new
|
40
|
+
|
41
|
+
transform = ETL::Transform::ForeignKeyLookupTransform.new(nil, 'name',
|
42
|
+
{:resolver => resolver, :cache => true})
|
43
|
+
|
44
|
+
assert_equal true, resolver.cache_loaded
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
data/test/multiple_delimited.ctl
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source :source1, {
|
4
4
|
:file => 'data/multiple_delimited_*.txt',
|
5
|
-
:parser => :
|
5
|
+
:parser => :csv
|
6
6
|
},
|
7
7
|
[
|
8
8
|
:first_name,
|
@@ -16,7 +16,7 @@ source :source1, {
|
|
16
16
|
|
17
17
|
source :source2, {
|
18
18
|
:file => 'data/multiple_delimited_*.txt',
|
19
|
-
:parser => :
|
19
|
+
:parser => :csv
|
20
20
|
},
|
21
21
|
[
|
22
22
|
:first_name,
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# puts "executing nokogiri_all.ctl"
|
2
|
+
|
3
|
+
source :in, {
|
4
|
+
:file => 'data/nokogiri.xml',
|
5
|
+
:parser => :nokogiri_xml
|
6
|
+
},
|
7
|
+
{
|
8
|
+
:collection => 'people/person',
|
9
|
+
:fields => [
|
10
|
+
:first_name,
|
11
|
+
:last_name,
|
12
|
+
{
|
13
|
+
:name => :ssn,
|
14
|
+
:xpath => '@ssn'
|
15
|
+
},
|
16
|
+
{
|
17
|
+
:name => :age,
|
18
|
+
:type => :integer
|
19
|
+
},
|
20
|
+
{
|
21
|
+
:name => :hair_colour,
|
22
|
+
:xpath => 'colours/hair'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
|
27
|
+
destination :out, {
|
28
|
+
:file => 'output/xml.txt'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
:order => [:first_name, :last_name, :ssn]
|
32
|
+
}
|
33
|
+
|
34
|
+
transform :ssn, :sha1
|
35
|
+
transform(:ssn){ |v| v[0,24] }
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# puts "executing nokogiri_select.ctl"
|
2
|
+
|
3
|
+
source :in, {
|
4
|
+
:file => 'data/nokogiri.xml',
|
5
|
+
:parser => :nokogiri_xml
|
6
|
+
},
|
7
|
+
{
|
8
|
+
:collection => 'people/person[@type="client"]',
|
9
|
+
:fields => [
|
10
|
+
:first_name,
|
11
|
+
:last_name,
|
12
|
+
{
|
13
|
+
:name => :ssn,
|
14
|
+
:xpath => '@ssn'
|
15
|
+
},
|
16
|
+
{
|
17
|
+
:name => :age,
|
18
|
+
:type => :integer
|
19
|
+
},
|
20
|
+
{
|
21
|
+
:name => :hair_colour,
|
22
|
+
:xpath => 'colours/hair'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
|
27
|
+
destination :out, {
|
28
|
+
:file => 'output/xml.txt'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
:order => [:first_name, :last_name, :ssn]
|
32
|
+
}
|
33
|
+
|
34
|
+
transform :ssn, :sha1
|
35
|
+
transform(:ssn){ |v| v[0,24] }
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
# Test the flat text parsers
|
4
|
+
class ParserTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
# Test the DOM-based Nokogiri XML parser. .
|
7
|
+
def test_nokogiri_xml_parser_for_all_nodes
|
8
|
+
control = ETL::Control::Control.resolve(
|
9
|
+
File.dirname(__FILE__) + '/nokogiri_all.ctl')
|
10
|
+
parser = ETL::Parser::NokogiriXmlParser.new(control.sources.first)
|
11
|
+
rows = parser.collect { |row| row }
|
12
|
+
assert_equal 3, rows.length
|
13
|
+
assert_equal(
|
14
|
+
{ :hair_colour=>"black",
|
15
|
+
:first_name=>"Bob",
|
16
|
+
:last_name=>"Smith",
|
17
|
+
:ssn=>"123456789", :age=>"24"}, rows.first)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Test the DOM-based Nokogiri XML parser. .
|
21
|
+
def test_nokogiri_xml_parser_for_selected_nodes
|
22
|
+
control = ETL::Control::Control.resolve(
|
23
|
+
File.dirname(__FILE__) + '/nokogiri_select.ctl')
|
24
|
+
parser = ETL::Parser::NokogiriXmlParser.new(control.sources.first)
|
25
|
+
rows = parser.collect { |row| row }
|
26
|
+
assert_equal 2, rows.length
|
27
|
+
assert_equal(
|
28
|
+
{ :age=>"37",
|
29
|
+
:hair_colour=>"black",
|
30
|
+
:first_name=>"Jake",
|
31
|
+
:last_name=>"Smithsonian",
|
32
|
+
:ssn=>"133244566"}, rows.last)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/test/parser_test.rb
CHANGED
@@ -3,9 +3,9 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
3
3
|
# Test the flat text parsers
|
4
4
|
class ParserTest < Test::Unit::TestCase
|
5
5
|
# Test parsing delimited data
|
6
|
-
def
|
6
|
+
def test_csv_parser
|
7
7
|
control = ETL::Control::Control.resolve(File.dirname(__FILE__) + '/delimited.ctl')
|
8
|
-
parser = ETL::Parser::
|
8
|
+
parser = ETL::Parser::CsvParser.new(control.sources.first)
|
9
9
|
rows = parser.collect { |row| row }
|
10
10
|
assert_equal 3, rows.length
|
11
11
|
assert_equal({:first_name=>"Chris", :last_name=>"Smith", :ssn=>"111223333", :age=>"24", :sex => 'M'}, rows.first)
|
data/test/processor_test.rb
CHANGED
data/test/scd_test.rb
CHANGED
@@ -72,10 +72,7 @@ class ScdTest < Test::Unit::TestCase
|
|
72
72
|
assert_equal 1, find_bobs.first.id
|
73
73
|
end
|
74
74
|
should "set the effective date" do
|
75
|
-
|
76
|
-
# doesn't consider things equal for some yet to be understood
|
77
|
-
# reason
|
78
|
-
assert_equal current_datetime.to_s, find_bobs.first.effective_date.to_s
|
75
|
+
assert_in_delta 1, current_datetime.to_time.to_i, find_bobs.first.effective_date.to_time.to_i
|
79
76
|
end
|
80
77
|
should "set the end date" do
|
81
78
|
assert_equal @end_of_time, find_bobs.first.end_date
|
@@ -115,10 +112,7 @@ class ScdTest < Test::Unit::TestCase
|
|
115
112
|
assert_los_angeles_address(find_bobs.detect { |bob| 2 == bob.id })
|
116
113
|
end
|
117
114
|
should "activate the new record" do
|
118
|
-
|
119
|
-
# doesn't consider things equal for some yet to be understood
|
120
|
-
# reason
|
121
|
-
assert_equal current_datetime.to_s, find_bobs.detect { |bob| 2 == bob.id }.effective_date.to_s
|
115
|
+
assert_in_delta 1, current_datetime.to_time.to_i, find_bobs.detect { |bob| 2 == bob.id }.effective_date.to_time.to_i
|
122
116
|
end
|
123
117
|
should "set the end date for the new record" do
|
124
118
|
assert_equal @end_of_time, find_bobs.detect { |bob| 2 == bob.id }.end_date
|
data/test/scd_test_type_1.ctl
CHANGED
data/test/scd_test_type_2.ctl
CHANGED
data/test/screen_test.rb
CHANGED
@@ -2,8 +2,7 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
class ScreenTest < Test::Unit::TestCase
|
4
4
|
def test_screen
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
ETL::Engine.process(File.dirname(__FILE__) + '/screen_test_fatal.ctl')
|
6
|
+
assert_equal 2, ETL::Engine.exit_code
|
8
7
|
end
|
9
8
|
end
|
data/test/source_test.rb
CHANGED
@@ -1,15 +1,28 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
2
2
|
|
3
|
-
class Person < ActiveRecord::Base
|
4
|
-
end
|
5
3
|
class SourceTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "source" do
|
6
|
+
should "set store_locally to true by default" do
|
7
|
+
assert_equal true, Source.new(nil, { :store_locally => true }, nil).store_locally
|
8
|
+
end
|
9
|
+
|
10
|
+
should "let the user set store_locally to true" do
|
11
|
+
assert_equal true, Source.new(nil, { :store_locally => true }, nil).store_locally
|
12
|
+
end
|
13
|
+
|
14
|
+
should "let the user set store_locally to false" do
|
15
|
+
assert_equal false, Source.new(nil, { :store_locally => false }, nil).store_locally
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
6
19
|
context "a file source" do
|
7
20
|
context "with delimited data" do
|
8
21
|
setup do
|
9
22
|
control = ETL::Control::Control.parse(File.dirname(__FILE__) + '/delimited.ctl')
|
10
23
|
configuration = {
|
11
24
|
:file => 'data/delimited.txt',
|
12
|
-
:parser => :
|
25
|
+
:parser => :csv
|
13
26
|
}
|
14
27
|
definition = self.definition + [:sex]
|
15
28
|
|
@@ -27,7 +40,7 @@ class SourceTest < Test::Unit::TestCase
|
|
27
40
|
control = ETL::Control::Control.parse(File.dirname(__FILE__) + '/multiple_delimited.ctl')
|
28
41
|
configuration = {
|
29
42
|
:file => 'data/multiple_delimited_*.txt',
|
30
|
-
:parser => :
|
43
|
+
:parser => :csv
|
31
44
|
}
|
32
45
|
|
33
46
|
source = ETL::Control::FileSource.new(control, configuration, definition)
|
@@ -46,7 +59,7 @@ class SourceTest < Test::Unit::TestCase
|
|
46
59
|
'/delimited_absolute.ctl')
|
47
60
|
configuration = {
|
48
61
|
:file => '/tmp/delimited_abs.txt',
|
49
|
-
:parser => :
|
62
|
+
:parser => :csv
|
50
63
|
}
|
51
64
|
definition = self.definition + [:sex]
|
52
65
|
|
@@ -85,7 +98,7 @@ class SourceTest < Test::Unit::TestCase
|
|
85
98
|
@source = ETL::Control::DatabaseSource.new(control, configuration, definition)
|
86
99
|
end
|
87
100
|
should "set the local file for extraction storage" do
|
88
|
-
assert_match %r{source_data/localhost/
|
101
|
+
assert_match %r{source_data/localhost/activewarehouse_etl_test/people/\d+.csv}, @source.local_file.to_s
|
89
102
|
end
|
90
103
|
should "find 1 row" do
|
91
104
|
Person.delete_all
|
data/test/test_helper.rb
CHANGED
@@ -1,24 +1,20 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
|
4
1
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
5
2
|
$:.unshift(File.dirname(__FILE__))
|
6
3
|
|
7
|
-
Dir[File.dirname(__FILE__) + "/vendor/**/lib"].each { |lib| $:.unshift(lib) }
|
8
|
-
|
9
4
|
require 'test/unit'
|
10
5
|
require 'pp'
|
11
6
|
require 'etl'
|
12
7
|
require 'shoulda'
|
13
8
|
require 'flexmock/test_unit'
|
14
9
|
|
15
|
-
|
10
|
+
raise "Missing required DB environment variable" unless ENV['DB']
|
11
|
+
|
12
|
+
database_yml = File.dirname(__FILE__) + '/config/database.yml'
|
13
|
+
ETL::Engine.init(:config => database_yml)
|
16
14
|
ETL::Engine.logger = Logger.new(STDOUT)
|
17
15
|
# ETL::Engine.logger.level = Logger::DEBUG
|
18
16
|
ETL::Engine.logger.level = Logger::FATAL
|
19
17
|
|
20
|
-
db = ENV['DB'] ||= 'mysql'
|
21
|
-
require "connection/#{db}/connection"
|
22
18
|
ActiveRecord::Base.establish_connection :operational_database
|
23
19
|
ETL::Execution::Job.delete_all
|
24
20
|
|
@@ -32,3 +28,5 @@ end
|
|
32
28
|
|
33
29
|
puts "ActiveRecord::VERSION = #{ActiveRecord::VERSION::STRING}"
|
34
30
|
|
31
|
+
class Person < ActiveRecord::Base
|
32
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
include ETL::Processor
|
4
|
+
|
5
|
+
class TruncateTest < ActiveRecord::Base
|
6
|
+
set_table_name 'truncate_test'
|
7
|
+
end
|
8
|
+
|
9
|
+
class TruncateProcessorTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def create_item!
|
12
|
+
TruncateTest.create!(:x => 'ABC')
|
13
|
+
end
|
14
|
+
|
15
|
+
def truncate!(options=nil)
|
16
|
+
TruncateProcessor.new(nil,
|
17
|
+
:target => :data_warehouse,
|
18
|
+
:table => TruncateTest.table_name,
|
19
|
+
:options => options
|
20
|
+
).process
|
21
|
+
end
|
22
|
+
|
23
|
+
should 'reset ids by default' do
|
24
|
+
create_item!
|
25
|
+
truncate!
|
26
|
+
assert_equal 1, create_item!.id
|
27
|
+
end
|
28
|
+
|
29
|
+
if ETL::Engine.connection(:data_warehouse).class.name =~ /postgres/i
|
30
|
+
should 'allow disabling id reset for postgres' do
|
31
|
+
truncate!
|
32
|
+
create_item!
|
33
|
+
truncate!('CONTINUE IDENTITY')
|
34
|
+
assert_equal 2, create_item!.id
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,142 +1,130 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: activewarehouse-etl
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.rc1
|
5
5
|
prerelease: 6
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 5
|
10
|
-
- rc
|
11
|
-
- 1
|
12
|
-
version: 0.9.5.rc1
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Anthony Eden
|
16
|
-
-
|
9
|
+
- Thibaut Barrère
|
17
10
|
autorequire:
|
18
11
|
bindir: bin
|
19
12
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-03-03 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
24
16
|
name: rake
|
25
|
-
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70307704843740 !ruby/object:Gem::Requirement
|
27
18
|
none: false
|
28
|
-
requirements:
|
29
|
-
- -
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
hash: 57
|
32
|
-
segments:
|
33
|
-
- 0
|
34
|
-
- 8
|
35
|
-
- 3
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
36
22
|
version: 0.8.3
|
37
23
|
type: :runtime
|
38
|
-
version_requirements: *id001
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: activesupport
|
41
24
|
prerelease: false
|
42
|
-
|
25
|
+
version_requirements: *70307704843740
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: activesupport
|
28
|
+
requirement: &70307704843000 !ruby/object:Gem::Requirement
|
43
29
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
48
|
-
segments:
|
49
|
-
- 2
|
50
|
-
- 1
|
51
|
-
- 0
|
52
|
-
version: 2.1.0
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
53
34
|
type: :runtime
|
54
|
-
version_requirements: *id002
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: activerecord
|
57
35
|
prerelease: false
|
58
|
-
|
36
|
+
version_requirements: *70307704843000
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activerecord
|
39
|
+
requirement: &70307704842100 !ruby/object:Gem::Requirement
|
59
40
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 2
|
66
|
-
- 1
|
67
|
-
- 0
|
68
|
-
version: 2.1.0
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 3.0.0
|
69
45
|
type: :runtime
|
70
|
-
version_requirements: *id003
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: fastercsv
|
73
46
|
prerelease: false
|
74
|
-
|
47
|
+
version_requirements: *70307704842100
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: fastercsv
|
50
|
+
requirement: &70307704841200 !ruby/object:Gem::Requirement
|
75
51
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
hash: 31
|
80
|
-
segments:
|
81
|
-
- 1
|
82
|
-
- 2
|
83
|
-
- 0
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
84
55
|
version: 1.2.0
|
85
56
|
type: :runtime
|
86
|
-
version_requirements: *id004
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
name: adapter_extensions
|
89
57
|
prerelease: false
|
90
|
-
|
58
|
+
version_requirements: *70307704841200
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: adapter_extensions
|
61
|
+
requirement: &70307704840560 !ruby/object:Gem::Requirement
|
91
62
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
97
|
-
- 0
|
98
|
-
- 5
|
99
|
-
- 0
|
100
|
-
version: 0.5.0
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.9.5.rc1
|
101
67
|
type: :runtime
|
102
|
-
version_requirements: *id005
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: spreadsheet
|
105
68
|
prerelease: false
|
106
|
-
|
69
|
+
version_requirements: *70307704840560
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: shoulda
|
72
|
+
requirement: &70307704839660 !ruby/object:Gem::Requirement
|
107
73
|
none: false
|
108
|
-
requirements:
|
109
|
-
- -
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.11.3
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *70307704839660
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: flexmock
|
83
|
+
requirement: &70307704839120 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.9.0
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *70307704839120
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: cartesian
|
94
|
+
requirement: &70307704838600 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *70307704838600
|
103
|
+
description: ActiveWarehouse ETL is a pure Ruby Extract-Transform-Load application
|
104
|
+
for loading data into a database.
|
105
|
+
email:
|
119
106
|
- thibaut.barrere@gmail.com
|
120
|
-
executables:
|
107
|
+
executables:
|
121
108
|
- etl
|
122
109
|
extensions: []
|
123
|
-
|
124
110
|
extra_rdoc_files: []
|
125
|
-
|
126
|
-
files:
|
111
|
+
files:
|
127
112
|
- .gitignore
|
113
|
+
- .standalone_migrations
|
114
|
+
- .travis.yml
|
128
115
|
- 0.9-UPGRADE
|
129
116
|
- CHANGELOG
|
130
117
|
- Gemfile
|
131
118
|
- HOW_TO_RELEASE
|
132
119
|
- LICENSE
|
133
|
-
- README
|
120
|
+
- README.textile
|
134
121
|
- Rakefile
|
135
122
|
- TODO
|
136
|
-
- active_support_logger.patch
|
137
123
|
- activewarehouse-etl.gemspec
|
138
124
|
- bin/etl
|
139
125
|
- bin/etl.cmd
|
126
|
+
- db/migrate/20120229203554_create_tables.rb
|
127
|
+
- db/schema.rb
|
140
128
|
- examples/database.example.yml
|
141
129
|
- lib/etl.rb
|
142
130
|
- lib/etl/batch.rb
|
@@ -149,16 +137,19 @@ files:
|
|
149
137
|
- lib/etl/control.rb
|
150
138
|
- lib/etl/control/control.rb
|
151
139
|
- lib/etl/control/destination.rb
|
140
|
+
- lib/etl/control/destination/csv_destination.rb
|
152
141
|
- lib/etl/control/destination/database_destination.rb
|
153
142
|
- lib/etl/control/destination/excel_destination.rb
|
154
143
|
- lib/etl/control/destination/file_destination.rb
|
155
144
|
- lib/etl/control/destination/insert_update_database_destination.rb
|
156
145
|
- lib/etl/control/destination/update_database_destination.rb
|
146
|
+
- lib/etl/control/destination/yaml_destination.rb
|
157
147
|
- lib/etl/control/source.rb
|
158
148
|
- lib/etl/control/source/database_source.rb
|
159
149
|
- lib/etl/control/source/enumerable_source.rb
|
160
150
|
- lib/etl/control/source/file_source.rb
|
161
151
|
- lib/etl/control/source/model_source.rb
|
152
|
+
- lib/etl/control/source/mysql_streamer.rb
|
162
153
|
- lib/etl/core_ext.rb
|
163
154
|
- lib/etl/core_ext/time.rb
|
164
155
|
- lib/etl/core_ext/time/calculations.rb
|
@@ -174,9 +165,10 @@ files:
|
|
174
165
|
- lib/etl/http_tools.rb
|
175
166
|
- lib/etl/parser.rb
|
176
167
|
- lib/etl/parser/apache_combined_log_parser.rb
|
177
|
-
- lib/etl/parser/
|
168
|
+
- lib/etl/parser/csv_parser.rb
|
178
169
|
- lib/etl/parser/excel_parser.rb
|
179
170
|
- lib/etl/parser/fixed_width_parser.rb
|
171
|
+
- lib/etl/parser/nokogiri_xml_parser.rb
|
180
172
|
- lib/etl/parser/parser.rb
|
181
173
|
- lib/etl/parser/sax_parser.rb
|
182
174
|
- lib/etl/parser/xml_parser.rb
|
@@ -188,6 +180,7 @@ files:
|
|
188
180
|
- lib/etl/processor/copy_field_processor.rb
|
189
181
|
- lib/etl/processor/database_join_processor.rb
|
190
182
|
- lib/etl/processor/encode_processor.rb
|
183
|
+
- lib/etl/processor/ensure_fields_presence_processor.rb
|
191
184
|
- lib/etl/processor/escape_csv_processor.rb
|
192
185
|
- lib/etl/processor/filter_row_processor.rb
|
193
186
|
- lib/etl/processor/ftp_downloader_processor.rb
|
@@ -217,18 +210,18 @@ files:
|
|
217
210
|
- lib/etl/transform/default_transform.rb
|
218
211
|
- lib/etl/transform/foreign_key_lookup_transform.rb
|
219
212
|
- lib/etl/transform/hierarchy_lookup_transform.rb
|
213
|
+
- lib/etl/transform/md5_transform.rb
|
220
214
|
- lib/etl/transform/ordinalize_transform.rb
|
221
215
|
- lib/etl/transform/sha1_transform.rb
|
222
216
|
- lib/etl/transform/split_fields_transform.rb
|
217
|
+
- lib/etl/transform/string_to_date_time_transform.rb
|
223
218
|
- lib/etl/transform/string_to_date_transform.rb
|
224
|
-
- lib/etl/transform/string_to_datetime_transform.rb
|
225
219
|
- lib/etl/transform/string_to_time_transform.rb
|
226
220
|
- lib/etl/transform/transform.rb
|
227
221
|
- lib/etl/transform/trim_transform.rb
|
228
222
|
- lib/etl/transform/type_transform.rb
|
229
223
|
- lib/etl/util.rb
|
230
224
|
- lib/etl/version.rb
|
231
|
-
- test-matrix.yml
|
232
225
|
- test/.gitignore
|
233
226
|
- test/.ignore
|
234
227
|
- test/all.ebf
|
@@ -242,16 +235,14 @@ files:
|
|
242
235
|
- test/block_processor_pre_post_process.ctl
|
243
236
|
- test/block_processor_remove_rows.ctl
|
244
237
|
- test/block_processor_test.rb
|
245
|
-
- test/
|
246
|
-
- test/
|
247
|
-
- test/config
|
248
|
-
- test/config/
|
249
|
-
- test/config/
|
250
|
-
- test/config/
|
251
|
-
- test/
|
252
|
-
- test/
|
253
|
-
- test/connection/postgresql/connection.rb
|
254
|
-
- test/connection/postgresql/schema.sql
|
238
|
+
- test/check_exist_processor_test.rb
|
239
|
+
- test/check_unique_processor_test.rb
|
240
|
+
- test/config/.gitignore
|
241
|
+
- test/config/database.yml
|
242
|
+
- test/config/gemfiles/Gemfile.rails-3.0.x
|
243
|
+
- test/config/gemfiles/Gemfile.rails-3.1.x
|
244
|
+
- test/config/gemfiles/Gemfile.rails-3.2.x
|
245
|
+
- test/config/gemfiles/common.rb
|
255
246
|
- test/control_test.rb
|
256
247
|
- test/data/apache_combined_log.txt
|
257
248
|
- test/data/bulk_import.txt
|
@@ -264,9 +255,11 @@ files:
|
|
264
255
|
- test/data/fixed_width.txt
|
265
256
|
- test/data/multiple_delimited_1.txt
|
266
257
|
- test/data/multiple_delimited_2.txt
|
258
|
+
- test/data/nokogiri.xml
|
267
259
|
- test/data/people.txt
|
268
260
|
- test/data/sax.xml
|
269
261
|
- test/data/xml.xml
|
262
|
+
- test/database_join_processor_test.rb
|
270
263
|
- test/date_dimension_builder_test.rb
|
271
264
|
- test/delimited.ctl
|
272
265
|
- test/delimited_absolute.ctl
|
@@ -279,11 +272,13 @@ files:
|
|
279
272
|
- test/directive_test.rb
|
280
273
|
- test/encode_processor_test.rb
|
281
274
|
- test/engine_test.rb
|
275
|
+
- test/ensure_fields_presence_processor_test.rb
|
282
276
|
- test/errors.ctl
|
283
277
|
- test/etl_test.rb
|
284
278
|
- test/excel.ctl
|
285
279
|
- test/excel2.ctl
|
286
280
|
- test/fixed_width.ctl
|
281
|
+
- test/foreign_key_lookup_transform_test.rb
|
287
282
|
- test/generator_test.rb
|
288
283
|
- test/inline_parser.ctl
|
289
284
|
- test/mocks/mock_destination.rb
|
@@ -291,6 +286,9 @@ files:
|
|
291
286
|
- test/model_source.ctl
|
292
287
|
- test/multiple_delimited.ctl
|
293
288
|
- test/multiple_source_delimited.ctl
|
289
|
+
- test/nokogiri_all.ctl
|
290
|
+
- test/nokogiri_select.ctl
|
291
|
+
- test/nokogiri_test.rb
|
294
292
|
- test/output/.ignore
|
295
293
|
- test/parser_test.rb
|
296
294
|
- test/performance/delimited.ctl
|
@@ -309,51 +307,30 @@ files:
|
|
309
307
|
- test/source_test.rb
|
310
308
|
- test/test_helper.rb
|
311
309
|
- test/transform_test.rb
|
312
|
-
- test/
|
313
|
-
- test/vendor/adapter_extensions-0.5.0/LICENSE
|
314
|
-
- test/vendor/adapter_extensions-0.5.0/README
|
315
|
-
- test/vendor/adapter_extensions-0.5.0/Rakefile
|
316
|
-
- test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions.rb
|
317
|
-
- test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/abstract_adapter.rb
|
318
|
-
- test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/mysql_adapter.rb
|
319
|
-
- test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/postgresql_adapter.rb
|
320
|
-
- test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/sqlserver_adapter.rb
|
321
|
-
- test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/version.rb
|
310
|
+
- test/truncate_processor_test.rb
|
322
311
|
- test/xml.ctl
|
323
312
|
homepage: https://github.com/activewarehouse/activewarehouse-etl
|
324
313
|
licenses: []
|
325
|
-
|
326
314
|
post_install_message:
|
327
315
|
rdoc_options: []
|
328
|
-
|
329
|
-
require_paths:
|
316
|
+
require_paths:
|
330
317
|
- lib
|
331
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
318
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
332
319
|
none: false
|
333
|
-
requirements:
|
334
|
-
- -
|
335
|
-
- !ruby/object:Gem::Version
|
336
|
-
|
337
|
-
|
338
|
-
- 0
|
339
|
-
version: "0"
|
340
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
320
|
+
requirements:
|
321
|
+
- - ! '>='
|
322
|
+
- !ruby/object:Gem::Version
|
323
|
+
version: '0'
|
324
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
341
325
|
none: false
|
342
|
-
requirements:
|
343
|
-
- -
|
344
|
-
- !ruby/object:Gem::Version
|
345
|
-
hash: 23
|
346
|
-
segments:
|
347
|
-
- 1
|
348
|
-
- 3
|
349
|
-
- 6
|
326
|
+
requirements:
|
327
|
+
- - ! '>='
|
328
|
+
- !ruby/object:Gem::Version
|
350
329
|
version: 1.3.6
|
351
330
|
requirements: []
|
352
|
-
|
353
331
|
rubyforge_project:
|
354
|
-
rubygems_version: 1.8.
|
332
|
+
rubygems_version: 1.8.15
|
355
333
|
signing_key:
|
356
334
|
specification_version: 3
|
357
335
|
summary: Pure Ruby ETL package.
|
358
336
|
test_files: []
|
359
|
-
|