Class: Redshifter::Util::UpdateTable
- Inherits:
-
Object
- Object
- Redshifter::Util::UpdateTable
- Defined in:
- lib/redshifter/util/update_table.rb
Instance Method Summary collapse
-
#initialize(table:, manifest_url:) ⇒ UpdateTable
constructor
A new instance of UpdateTable.
- #run(conn = Redshift.connect) ⇒ Object
Constructor Details
#initialize(table:, manifest_url:) ⇒ UpdateTable
Returns a new instance of UpdateTable.
4 5 6 7 |
# File 'lib/redshifter/util/update_table.rb', line 4 def initialize(table:, manifest_url:) @table = table @manifest_url = manifest_url end |
Instance Method Details
#run(conn = Redshift.connect) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/redshifter/util/update_table.rb', line 9 def run(conn = Redshift.connect) conn.transaction do |within_transaction| [ create_and_load_temp_table_sql, upsert_changes_sql, cleanup_temp_table_sql, analyze_updated_table_sql ].each do |query| within_transaction.exec(query) end end end |