Module: BeetleETL

Defined in:
lib/beetle_etl.rb,
lib/beetle_etl/import.rb,
lib/beetle_etl/naming.rb,
lib/beetle_etl/dsl/dsl.rb,
lib/beetle_etl/testing.rb,
lib/beetle_etl/version.rb,
lib/beetle_etl/reporter.rb,
lib/beetle_etl/steps/load.rb,
lib/beetle_etl/steps/step.rb,
lib/beetle_etl/steps/transform.rb,
lib/beetle_etl/steps/assign_ids.rb,
lib/beetle_etl/steps/drop_stage.rb,
lib/beetle_etl/steps/table_diff.rb,
lib/beetle_etl/dsl/transformation.rb,
lib/beetle_etl/steps/create_stage.rb,
lib/beetle_etl/steps/map_relations.rb,
lib/beetle_etl/testing/test_wrapper.rb,
lib/beetle_etl/dsl/transformation_loader.rb,
lib/beetle_etl/step_runner/async_step_runner.rb,
lib/beetle_etl/step_runner/dependency_resolver.rb

Defined Under Namespace

Modules: Naming, Testing Classes: AssignIds, AsyncStepRunner, Configuration, CreateStage, DSL, DependencyResolver, DropStage, Import, Load, MapRelations, Reporter, Step, TableDiff, Transform, Transformation, TransformationLoader

Constant Summary collapse

InvalidConfigurationError =
Class.new(StandardError)
VERSION =
"1.0.1"
ColumnDefinitionNotFoundError =
Class.new(StandardError)
NoColumnsDefinedError =
Class.new(StandardError)
UnsatisfiableDependenciesError =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.configObject



63
64
65
# File 'lib/beetle_etl.rb', line 63

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



59
60
61
# File 'lib/beetle_etl.rb', line 59

def configure
  yield(config)
end

.databaseObject



71
72
73
74
75
76
77
78
79
80
# File 'lib/beetle_etl.rb', line 71

def database
  if config.database
    config.database
  elsif config.database_config
    @database ||= Sequel.connect(config.database_config)
  else
    msg = "Either Sequel connection database_config or a Sequel Database object required"
    raise InvalidConfigurationError.new(msg)
  end
end

.importObject



49
50
51
52
53
54
55
56
57
# File 'lib/beetle_etl.rb', line 49

def import
  begin
    report = Import.new.run
    Reporter.new(report).log_summary
    report
  ensure
    @database.disconnect if @database
  end
end

.loggerObject



67
68
69
# File 'lib/beetle_etl.rb', line 67

def logger
  config.logger
end

.resetObject



82
83
84
85
# File 'lib/beetle_etl.rb', line 82

def reset
  @config = nil
  @database = nil
end