Module: BeetleETL::Naming

Extended by:
Naming
Included in:
Naming, Step
Defined in:
lib/beetle_etl/naming.rb

Instance Method Summary collapse

Instance Method Details

#stage_table_name(table_name = nil) ⇒ Object



8
9
10
11
12
# File 'lib/beetle_etl/naming.rb', line 8

def stage_table_name(table_name = nil)
  name = (table_name || @table_name).to_s
  digest = Digest::MD5.hexdigest(name)
  "#{BeetleETL.config.external_source}-#{name}-#{digest}"[0, 63]
end

#stage_table_name_sql(table_name = nil) ⇒ Object



14
15
16
# File 'lib/beetle_etl/naming.rb', line 14

def stage_table_name_sql(table_name = nil)
  %Q("#{stage_table_name(table_name)}")
end

#target_table_name(table_name = nil) ⇒ Object



18
19
20
21
# File 'lib/beetle_etl/naming.rb', line 18

def target_table_name(table_name = nil)
  name = (table_name || @table_name).to_s
  [target_schema, name].compact.join('.')
end

#target_table_name_sql(table_name = nil) ⇒ Object



23
24
25
26
27
# File 'lib/beetle_etl/naming.rb', line 23

def target_table_name_sql(table_name = nil)
  name = (table_name || @table_name).to_s
  target_table_name= [target_schema, name].compact.join('"."')
  %Q("#{target_table_name}")
end