Class: Flydata::Output::RedshiftDDLRunner
- Inherits:
-
Object
- Object
- Flydata::Output::RedshiftDDLRunner
- Includes:
- CommandLoggable
- Defined in:
- lib/flydata/output/ddl_runner.rb
Instance Method Summary collapse
-
#initialize(dbconf, de) ⇒ RedshiftDDLRunner
constructor
A new instance of RedshiftDDLRunner.
- #run_ddls(flydata_tabledefs) ⇒ Object
Methods included from CommandLoggable
#before_logging, #log_error_stderr, #log_info_stdout, #log_warn_stderr
Constructor Details
#initialize(dbconf, de) ⇒ RedshiftDDLRunner
Returns a new instance of RedshiftDDLRunner.
10 11 12 13 14 15 16 |
# File 'lib/flydata/output/ddl_runner.rb', line 10 def initialize(dbconf, de) @pg_client = FlydataCore::Postgresql::PGClient.new(dbconf, notice_receiver: Proc.new{|result| log_info_stdout(" #{result..to_s.strip}") }) @schema_name = de['schema_name'] @schema_name = nil if @schema_name.to_s.strip.empty? end |
Instance Method Details
#run_ddls(flydata_tabledefs) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/flydata/output/ddl_runner.rb', line 18 def run_ddls(flydata_tabledefs) @pg_client.establish_connection create_schema create_ctl_tables flydata_tabledefs.each.with_index(1) do |flydata_tabledef, index| run_ddl(flydata_tabledef, index, flydata_tabledefs.size) end ensure @pg_client.close end |