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.
Files changed (104) hide show
  1. data/.standalone_migrations +2 -0
  2. data/.travis.yml +15 -0
  3. data/CHANGELOG +10 -1
  4. data/HOW_TO_RELEASE +4 -0
  5. data/LICENSE +1 -1
  6. data/README.textile +111 -0
  7. data/Rakefile +37 -78
  8. data/activewarehouse-etl.gemspec +7 -4
  9. data/db/migrate/20120229203554_create_tables.rb +37 -0
  10. data/db/schema.rb +45 -0
  11. data/examples/database.example.yml +3 -3
  12. data/lib/etl.rb +16 -0
  13. data/lib/etl/commands/etl.rb +1 -0
  14. data/lib/etl/control/control.rb +1 -1
  15. data/lib/etl/control/destination.rb +5 -16
  16. data/lib/etl/control/destination/csv_destination.rb +122 -0
  17. data/lib/etl/control/destination/excel_destination.rb +1 -1
  18. data/lib/etl/control/destination/insert_update_database_destination.rb +6 -3
  19. data/lib/etl/control/destination/yaml_destination.rb +74 -0
  20. data/lib/etl/control/source.rb +39 -4
  21. data/lib/etl/control/source/database_source.rb +6 -1
  22. data/lib/etl/control/source/file_source.rb +4 -0
  23. data/lib/etl/control/source/mysql_streamer.rb +31 -0
  24. data/lib/etl/engine.rb +40 -20
  25. data/lib/etl/parser/{delimited_parser.rb → csv_parser.rb} +3 -3
  26. data/lib/etl/parser/excel_parser.rb +1 -1
  27. data/lib/etl/parser/nokogiri_xml_parser.rb +83 -0
  28. data/lib/etl/processor/bulk_import_processor.rb +11 -0
  29. data/lib/etl/processor/check_exist_processor.rb +6 -6
  30. data/lib/etl/processor/check_unique_processor.rb +4 -0
  31. data/lib/etl/processor/database_join_processor.rb +25 -4
  32. data/lib/etl/processor/encode_processor.rb +0 -2
  33. data/lib/etl/processor/ensure_fields_presence_processor.rb +24 -0
  34. data/lib/etl/processor/imapattachment_downloader_processor.rb +2 -2
  35. data/lib/etl/processor/pop3attachment_downloader_processor.rb +2 -2
  36. data/lib/etl/processor/row_processor.rb +10 -0
  37. data/lib/etl/processor/sftp_downloader_processor.rb +1 -1
  38. data/lib/etl/processor/sftp_uploader_processor.rb +1 -1
  39. data/lib/etl/processor/truncate_processor.rb +4 -1
  40. data/lib/etl/processor/zip_file_processor.rb +1 -1
  41. data/lib/etl/transform/foreign_key_lookup_transform.rb +57 -15
  42. data/lib/etl/transform/md5_transform.rb +13 -0
  43. data/lib/etl/transform/{string_to_datetime_transform.rb → string_to_date_time_transform.rb} +0 -0
  44. data/lib/etl/version.rb +1 -1
  45. data/test/.gitignore +0 -1
  46. data/test/check_exist_processor_test.rb +89 -0
  47. data/test/check_unique_processor_test.rb +40 -0
  48. data/test/config/.gitignore +1 -0
  49. data/test/config/database.yml +28 -0
  50. data/test/config/{Gemfile.rails-3.0.x → gemfiles/Gemfile.rails-3.0.x} +1 -1
  51. data/test/config/{Gemfile.rails-2.3.x → gemfiles/Gemfile.rails-3.1.x} +1 -1
  52. data/test/config/gemfiles/Gemfile.rails-3.2.x +3 -0
  53. data/test/config/gemfiles/common.rb +29 -0
  54. data/test/control_test.rb +2 -2
  55. data/test/data/nokogiri.xml +38 -0
  56. data/test/database_join_processor_test.rb +43 -0
  57. data/test/delimited.ctl +1 -1
  58. data/test/delimited_absolute.ctl +1 -3
  59. data/test/delimited_destination_db.ctl +1 -3
  60. data/test/delimited_excel.ctl +1 -1
  61. data/test/delimited_insert_update.ctl +1 -1
  62. data/test/delimited_update.ctl +1 -1
  63. data/test/delimited_with_bulk_load.ctl +2 -2
  64. data/test/destination_test.rb +0 -4
  65. data/test/encode_processor_test.rb +2 -0
  66. data/test/engine_test.rb +65 -19
  67. data/test/ensure_fields_presence_processor_test.rb +33 -0
  68. data/test/foreign_key_lookup_transform_test.rb +50 -0
  69. data/test/multiple_delimited.ctl +1 -1
  70. data/test/multiple_source_delimited.ctl +2 -2
  71. data/test/nokogiri_all.ctl +35 -0
  72. data/test/nokogiri_select.ctl +35 -0
  73. data/test/nokogiri_test.rb +35 -0
  74. data/test/parser_test.rb +2 -2
  75. data/test/performance/delimited.ctl +1 -1
  76. data/test/processor_test.rb +0 -3
  77. data/test/scd_test.rb +2 -8
  78. data/test/scd_test_type_1.ctl +1 -1
  79. data/test/scd_test_type_2.ctl +1 -1
  80. data/test/screen_test.rb +2 -3
  81. data/test/source_test.rb +19 -6
  82. data/test/test_helper.rb +6 -8
  83. data/test/truncate_processor_test.rb +37 -0
  84. metadata +121 -144
  85. data/README +0 -101
  86. data/active_support_logger.patch +0 -78
  87. data/test-matrix.yml +0 -10
  88. data/test/config/Gemfile.rails-2.3.x.lock +0 -38
  89. data/test/config/Gemfile.rails-3.0.x.lock +0 -49
  90. data/test/config/common.rb +0 -21
  91. data/test/connection/mysql/connection.rb +0 -9
  92. data/test/connection/mysql/schema.sql +0 -36
  93. data/test/connection/postgresql/connection.rb +0 -13
  94. data/test/connection/postgresql/schema.sql +0 -39
  95. data/test/vendor/adapter_extensions-0.5.0/CHANGELOG +0 -26
  96. data/test/vendor/adapter_extensions-0.5.0/LICENSE +0 -16
  97. data/test/vendor/adapter_extensions-0.5.0/README +0 -7
  98. data/test/vendor/adapter_extensions-0.5.0/Rakefile +0 -158
  99. data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions.rb +0 -12
  100. data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/abstract_adapter.rb +0 -44
  101. data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/mysql_adapter.rb +0 -63
  102. data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/postgresql_adapter.rb +0 -52
  103. data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/connection_adapters/sqlserver_adapter.rb +0 -44
  104. data/test/vendor/adapter_extensions-0.5.0/lib/adapter_extensions/version.rb +0 -10
@@ -0,0 +1,2 @@
1
+ config:
2
+ database: test/config/database.yml
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ gemfile:
3
+ - test/config/gemfiles/Gemfile.rails-3.2.x
4
+ - test/config/gemfiles/Gemfile.rails-3.1.x
5
+ - test/config/gemfiles/Gemfile.rails-3.0.x
6
+ rvm:
7
+ - 1.9.3
8
+ - 1.8.7
9
+ env:
10
+ - DB=mysql2
11
+ - DB=postgresql
12
+ before_script:
13
+ - bundle exec rake db:create RAILS_ENV=$DB
14
+ - bundle exec rake db:create RAILS_ENV=etl_execution
15
+ - bundle exec rake db:schema:load RAILS_ENV=$DB
data/CHANGELOG CHANGED
@@ -1,9 +1,18 @@
1
1
  0.9.5 - unreleased
2
+ * EnsureFieldsPresenceProcessor treat symbols and strings equally (thbar)
3
+ * BREAKING CHANGE: you must require 'iconv' if you use the :encode_processor from now on (thbar)
4
+ * A non-zero exit code should be returned on fatal screen or exceeded error threshold (thbar)
5
+ * BREAKING CHANGE: the TruncateProcessor will now RESTART IDENTITY when using postgres - this behaviour can be changed by passing :options => 'CONTINUE IDENTITY' (thbar)
6
+ * New EnsureFieldsPresenceProcessor (thbar)
7
+ * New CsvDestination based on FasterCSV (lgustafson)
8
+ * Fix #41: Allow cache to be turned off on ForeignKeyLookupTransform
9
+ * Fix #36: etl --read-locally picks wrong last file (lgustafson)
10
+ * BREAKING CHANGE: DelimitedParser has been renamed to CsvParser, to emphasize the fact that this parser relies on FasterCSV under the hood (which means it will choke on faulty data).
2
11
  * Fixes for Rails 3 (gkfabs)
3
12
  * Fixes for Ruby 1.9.2 (jlecour, byrnejb, thbar)
4
13
  * improvements on CalculationTransform (gkfabs)
5
14
  * batch can have children (gkfabs)
6
- * read all columns by default in DelimitedSource (smeyfroi)
15
+ * read all columns by default in CsvParser (smeyfroi)
7
16
  * Turn db config into a HashWithIndifferentAccess (smeyfroi)
8
17
  * DatabaseJoinProcessor (gkfabs)
9
18
  * ImapattachmentDownloaderProcessor (gkfabs)
@@ -4,6 +4,10 @@
4
4
 
5
5
  rake release
6
6
 
7
+ * if you remain stuck at "Pushed git commits and tags", the task may silently wait for your password. Check this if it's the case:
8
+
9
+ https://github.com/carlhuda/bundler/issues/980
10
+
7
11
  * you can list changes using github:
8
12
 
9
13
  https://github.com/activewarehouse/activewarehouse-etl/compare/release-0.9.1...master
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2007 Anthony Eden
1
+ Copyright (c) 2006-2011 Anthony Eden, Thibaut Barrère
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
@@ -0,0 +1,111 @@
1
+ h1. ActiveWarehouse-ETL
2
+
3
+ ActiveWarehouse-ETL is a Ruby Extract-Transform-Load (ETL) tool.
4
+
5
+ This tool is both usable and used in production under its current form - but be aware the project is under reorganization: a new team is shaping up and we're working mostly on making it easier for people to contribute first. Up-to-date documentation will only come later.
6
+
7
+ "!https://secure.travis-ci.org/activewarehouse/activewarehouse-etl.png!":http://travis-ci.org/activewarehouse/activewarehouse-etl
8
+
9
+ h2. Usage
10
+
11
+ The documentation is sparse and not everything is up to date, too, but here are useful bits to get you started:
12
+
13
+ * read the "Introduction":https://github.com/activewarehouse/activewarehouse-etl/wiki/Documentation
14
+ * later on, refer to the "RDoc":http://rdoc.info/github/activewarehouse/activewarehouse-etl/master/frames (be sure to check out Processor and Transform)
15
+ * read the "source":https://github.com/activewarehouse/activewarehouse-etl/tree/master/lib/etl
16
+
17
+ If you're lost, please ask questions on the "Google Group":http://groups.google.com/group/activewarehouse-discuss and we'll take care of it.
18
+
19
+ One thing to keep in mind is that ActiveWarehouse-ETL is highly hackable: you can pretty much create all you need with extra ruby code, even if it's not currently supported.
20
+
21
+ h2. Compatibility
22
+
23
+ See "Travis":http://travis-ci.org/activewarehouse/activewarehouse-etl and our set of "gemfiles":https://github.com/activewarehouse/activewarehouse-etl/tree/master/test/config/gemfiles for the currently tested combinations.
24
+
25
+ If you meet any error, please drop a line on the "Google Group":http://groups.google.com/group/activewarehouse-discuss so that we can fix it.
26
+
27
+ h2. Contributing
28
+
29
+ Fork on GitHub and after you've committed tested patches, send a pull request.
30
+
31
+ TODO: explain how to run the tests like on Travis.
32
+
33
+ * install RVM and Bundler
34
+ * install MySQL and/or Postgresql (you can use brew for that)
35
+ * edit test/config/database.yml if needed (don't commit this file though)
36
+ * run (for instance):
37
+
38
+ @rake "ci:run_one[mysql2,test/config/gemfiles/Gemfile.rails-3.0.x]"@
39
+
40
+ or for all the combinations:
41
+
42
+ @rake ci:run_matrix@
43
+
44
+ h2. Contributors
45
+
46
+ ActiveWarehouse-ETL is the work of many people since late 2006 - here is a list, in no particular order:
47
+
48
+ * Anthony Eden
49
+ * Chris DiMartino
50
+ * Darrell Fuhriman
51
+ * Fabien Carrion
52
+ * Jacob Maine
53
+ * James B. Byrne
54
+ * Jay Zeschin
55
+ * Jeremy Lecour
56
+ * Steve Meyfroidt
57
+ * Seth Ladd
58
+ * Thibaut Barrère
59
+ * Stephen Touset
60
+ * sasikumargn
61
+ * Andrew Kuklewicz
62
+ * Leif Gustafson
63
+ * Andrew Sodt
64
+ * Tyler Kiley
65
+ * Colman Nady
66
+ * Scott Gonyea
67
+
68
+ If your name should be on the list but isn't, please leave a comment!
69
+
70
+ h2. Features
71
+
72
+ Currently supported features:
73
+
74
+ * ETL Domain Specific Language (DSL) - Control files are specified in a Ruby-based DSL
75
+ * Multiple source types. Current supported types:
76
+ ** Fixed-width and delimited text files
77
+ ** XML files through SAX
78
+ ** Apache combined log format
79
+ * Multiple destination types - file and database destinations
80
+ * Support for extracting from multiple sources in a single job
81
+ * Support for writing to multiple destinations in a single job
82
+ * A variety of built-in transformations are included:
83
+ ** Date-to-string, string-to-date, string-to-datetime, string-to-timestamp
84
+ ** Type transformation supporting strings, integers, floats and big decimals
85
+ ** Trim
86
+ ** SHA-1
87
+ ** Decode from an external decode file
88
+ ** Default replacement for empty values
89
+ ** Ordinalize
90
+ ** Hierarchy lookup
91
+ ** Foreign key lookup
92
+ ** Ruby blocks
93
+ ** Any custom transformation class
94
+ * A variety of build-in row-level processors
95
+ ** Check exists processor to determine if the record already exists in the destination database
96
+ ** Check unique processor to determine whether a matching record was processed during this job execution
97
+ ** Copy field
98
+ ** Rename field
99
+ ** Hierarchy exploder which takes a tree structure defined through a parent id and explodes it into a hierarchy bridge table
100
+ ** Surrogate key generator including support for looking up the last surrogate key from the target table using a custom query
101
+ ** Sequence generator including support for context-sensitive sequences where the context can be defined as a combination of fields from the source data
102
+ ** New row-level processors can easily be defined and applied
103
+ * Pre-processing
104
+ ** Truncate processor
105
+ * Post-processing
106
+ ** Bulk import using native RDBMS bulk loader tools
107
+ * Virtual fields - Add a field to the destination data which doesn't exist in the source data
108
+ * Built in job and record meta data
109
+ * Support for type 1 and type 2 slowly changing dimensions
110
+ ** Automated effective date and end date time stamping for type 2
111
+ ** CRC checking
data/Rakefile CHANGED
@@ -1,97 +1,56 @@
1
- require 'bundler/gem_tasks'
2
-
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
3
  require 'rake'
4
4
  require 'rake/testtask'
5
- require 'rdoc'
6
- require 'rdoc/task'
7
-
8
- namespace :test do
9
5
 
10
- def run_tests(rvm, rails, database)
11
- database_yml = File.dirname(__FILE__) + "/test/config/database.#{database}.yml"
12
- FileUtils.cp(database_yml, 'test/database.yml')
6
+ def system!(cmd)
7
+ puts cmd
8
+ raise "Command failed!" unless system(cmd)
9
+ end
13
10
 
14
- puts
15
- puts "============ Ruby #{rvm} - Rails #{rails} - Db #{database} ============="
16
- puts
11
+ begin
12
+ require 'tasks/standalone_migrations'
13
+ rescue LoadError => e
14
+ puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: #{e})"
15
+ end
17
16
 
18
- sh <<-BASH
19
- BUNDLE_GEMFILE=test/config/Gemfile.rails-#{rails} bundle install > null
20
- BUNDLE_GEMFILE=test/config/Gemfile.rails-#{rails} rvm #{rvm} rake test
21
- BASH
17
+ # experimental tasks to reproduce the Travis behaviour locally
18
+ namespace :ci do
19
+
20
+ desc "For current RVM, run the tests for one db and one gemfile"
21
+ task :run_one, :db, :gemfile do |t, args|
22
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(args[:gemfile] || (File.dirname(__FILE__) + '/test/config/gemfiles/Gemfile.rails-3.2.x'))
23
+ ENV['DB'] = args[:db] || 'mysql2'
24
+ system! "bundle install"
25
+ system! "bundle exec rake db:create"
26
+ system! "bundle exec rake db:create RAILS_ENV=etl_execution"
27
+ system! "bundle exec rake db:schema:load"
28
+ system! "bundle exec rake"
22
29
  end
23
30
 
24
- desc 'Run the tests in all combinations described in test-matrix.yml'
25
- task :matrix do
26
- # a la travis
27
- require 'yaml'
28
- data = YAML.load(IO.read(File.dirname(__FILE__) + '/test-matrix.yml'))
29
- data['rvm'].each do |rvm|
30
- data['rails'].each do |rails|
31
- data['database'].each do |database|
32
- run_tests(rvm, rails, database)
33
- end
34
- end
31
+ desc "For current RVM, run the tests for all the combination in travis configuration"
32
+ task :run_matrix do
33
+ require 'cartesian'
34
+ config = YAML.load_file('.travis.yml')
35
+ config['env'].cartesian(config['gemfile']).each do |*x|
36
+ env, gemfile = *x.flatten
37
+ db = env.gsub('DB=', '')
38
+ print [db, gemfile].inspect.ljust(40) + ": "
39
+ cmd = "rake \"ci:run_one[#{db},#{gemfile}]\""
40
+ result = system "#{cmd} > /dev/null 2>&1"
41
+ result = result ? "OK" : "FAILED! - re-run with: #{cmd}"
42
+ puts result
35
43
  end
36
44
  end
45
+
37
46
  end
38
47
 
39
48
  task :default => :test
40
49
 
41
50
  desc 'Test the ETL application.'
42
51
  Rake::TestTask.new(:test) do |t|
43
- t.libs << 'lib'
52
+ t.libs << 'lib' << '.'
44
53
  t.pattern = 'test/**/*_test.rb'
45
54
  t.verbose = true
46
55
  # TODO: reset the database
47
56
  end
48
-
49
- desc 'Generate documentation for the ETL application.'
50
- Rake::RDocTask.new(:rdoc) do |rdoc|
51
- rdoc.rdoc_dir = 'rdoc'
52
- rdoc.title = 'ActiveWarehouse ETL'
53
- rdoc.options << '--line-numbers' << '--inline-source'
54
- rdoc.rdoc_files.include('README')
55
- rdoc.rdoc_files.include('lib/**/*.rb')
56
- end
57
-
58
- namespace :rcov do
59
- desc 'Measures test coverage'
60
- task :test do
61
- rm_f 'coverage.data'
62
- mkdir 'coverage' unless File.exist?('coverage')
63
- rcov = "rcov --aggregate coverage.data --text-summary -Ilib"
64
- system("#{rcov} test/*_test.rb")
65
- # system("open coverage/index.html") if PLATFORM['darwin']
66
- end
67
- end
68
-
69
- desc "Generate code statistics"
70
- task :lines do
71
- lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
72
-
73
- for file_name in FileList["lib/**/*.rb"]
74
- next if file_name =~ /vendor/
75
- f = File.open(file_name)
76
-
77
- while line = f.gets
78
- lines += 1
79
- next if line =~ /^\s*$/
80
- next if line =~ /^\s*#/
81
- codelines += 1
82
- end
83
- puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
84
-
85
- total_lines += lines
86
- total_codelines += codelines
87
-
88
- lines, codelines = 0, 0
89
- end
90
-
91
- puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
92
- end
93
-
94
- desc "Publish the API documentation (UNTESTED CURRENTLY)"
95
- task :pdoc => [:rdoc] do
96
- Rake::SshDirPublisher.new("aeden@rubyforge.org", "/var/www/gforge-projects/activewarehouse/etl/rdoc", "rdoc").upload
97
- end
@@ -17,11 +17,14 @@ Gem::Specification.new do |s|
17
17
  s.required_rubygems_version = ">= 1.3.6"
18
18
 
19
19
  s.add_runtime_dependency('rake', '>= 0.8.3')
20
- s.add_runtime_dependency('activesupport', '>= 2.1.0')
21
- s.add_runtime_dependency('activerecord', '>= 2.1.0')
20
+ s.add_runtime_dependency('activesupport', '>= 3.0.0')
21
+ s.add_runtime_dependency('activerecord', '>= 3.0.0')
22
22
  s.add_runtime_dependency('fastercsv', '>= 1.2.0')
23
- s.add_runtime_dependency('adapter_extensions', '>= 0.5.0')
24
- s.add_runtime_dependency('spreadsheet')
23
+ s.add_runtime_dependency('adapter_extensions', '>= 0.9.5.rc1')
24
+
25
+ s.add_development_dependency('shoulda', '~>2.11.3')
26
+ s.add_development_dependency('flexmock', '~>0.9.0')
27
+ s.add_development_dependency('cartesian')
25
28
 
26
29
  s.files = `git ls-files`.split("\n")
27
30
  s.test_files = `git ls-files -- {test}/*`.split("\n")
@@ -0,0 +1,37 @@
1
+ class CreateTables < ActiveRecord::Migration
2
+ def self.up
3
+ create_table(:people, :force => true) do |t|
4
+ t.column :first_name, :string
5
+ t.column :last_name, :string
6
+ t.column :ssn, :string, :limit => 64
7
+ end
8
+
9
+ create_table(:places, :force => true) do |t|
10
+ t.column :address, :text
11
+ t.column :city, :string
12
+ t.column :state, :string
13
+ t.column :country, :string, :limit => 2
14
+ end
15
+
16
+ create_table(:person_dimension, :force => true) do |t|
17
+ t.column :first_name, :string, :limit => 50
18
+ t.column :last_name, :string, :limit => 50
19
+ t.column :address, :string, :limit => 100
20
+ t.column :city, :string, :limit => 50
21
+ t.column :state, :string, :limit => 50
22
+ t.column :zip_code, :string, :limit => 20
23
+
24
+ t.column :effective_date, :timestamp
25
+ t.column :end_date, :timestamp
26
+ t.column :latest_version, :boolean
27
+ end
28
+
29
+ create_table(:truncate_test, :force => true) do |t|
30
+ t.column :x, :string, :limit => 4
31
+ end
32
+ end
33
+
34
+ def self.down
35
+ raise ActiveRecord::IrreversibleMigration
36
+ end
37
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20120229203554) do
15
+
16
+ create_table "people", :force => true do |t|
17
+ t.string "first_name"
18
+ t.string "last_name"
19
+ t.string "ssn", :limit => 64
20
+ end
21
+
22
+ create_table "person_dimension", :force => true do |t|
23
+ t.string "first_name", :limit => 50
24
+ t.string "last_name", :limit => 50
25
+ t.string "address", :limit => 100
26
+ t.string "city", :limit => 50
27
+ t.string "state", :limit => 50
28
+ t.string "zip_code", :limit => 20
29
+ t.datetime "effective_date"
30
+ t.datetime "end_date"
31
+ t.boolean "latest_version"
32
+ end
33
+
34
+ create_table "places", :force => true do |t|
35
+ t.text "address"
36
+ t.string "city"
37
+ t.string "state"
38
+ t.string "country", :limit => 2
39
+ end
40
+
41
+ create_table "truncate_test", :force => true do |t|
42
+ t.string "x", :limit => 4
43
+ end
44
+
45
+ end
@@ -1,16 +1,16 @@
1
1
  etl_execution:
2
- adapter: mysql
2
+ adapter: mysql2
3
3
  username: root
4
4
  host: localhost
5
5
  database: etl_execution
6
6
  encoding: utf8
7
7
  datawarehouse:
8
- adapter: mysql
8
+ adapter: mysql2
9
9
  username: root
10
10
  host: localhost
11
11
  database: datawarehouse_development
12
12
  operational:
13
- adapter: mysql
13
+ adapter: mysql2
14
14
  username: root
15
15
  host: localhost
16
16
  database: operational_production
data/lib/etl.rb CHANGED
@@ -42,6 +42,11 @@ require 'active_support'
42
42
  require 'active_record'
43
43
  require 'adapter_extensions'
44
44
 
45
+ if ActiveSupport::VERSION::STRING >= '3.2'
46
+ # support for cattr_accessor
47
+ require 'active_support/core_ext/class/attribute_accessors'
48
+ end
49
+
45
50
  if RUBY_VERSION < '1.9'
46
51
  require 'faster_csv'
47
52
  CSV = FasterCSV unless defined?(CSV)
@@ -49,6 +54,17 @@ else
49
54
  require 'csv'
50
55
  end
51
56
 
57
+ # patch for https://github.com/activewarehouse/activewarehouse-etl/issues/24
58
+ # allow components to require optional gems
59
+ class Object
60
+ def optional_require(feature)
61
+ begin
62
+ require feature
63
+ rescue LoadError
64
+ end
65
+ end
66
+ end
67
+
52
68
  $:.unshift(File.dirname(__FILE__))
53
69
 
54
70
  require 'etl/core_ext'