Sha256: e2ed911710a440cd331cb741128d1292c59cc21be6d843aac99f2cf54424d5a1
Contents?: true
Size: 903 Bytes
Versions: 4
Compression:
Stored size: 903 Bytes
Contents
class Cranium::ImportStrategy::Base attr_reader :import_definition def initialize(import_definition) @import_definition = import_definition end def import external_table = Cranium::ExternalTable.new Cranium.application.sources[import_definition.name], Cranium::Database.connection, error_threshold: @import_definition.error_threshold external_table.create number_of_items_imported = import_from external_table.name external_table.destroy number_of_items_imported end protected def import_from(external_table) raise StandardError "Not implemented" end def database Cranium::Database.connection end def target_table import_definition.into end def source_fields import_definition.field_associations.keys.map &:to_sym end def target_fields import_definition.field_associations.values.map &:to_sym end end
Version data entries
4 entries across 4 versions & 1 rubygems