diff --git a/Gemfile.lock b/Gemfile.lock index c85f203..d740219 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,20 +3,20 @@ PATH specs: postgres_to_redshift (0.1.2) aws-sdk-v1 (~> 1.54) - pg (~> 0.17.0) + pg (~> 0.18.0) GEM remote: https://rubygems.org/ specs: - aws-sdk-v1 (1.66.0) + aws-sdk-v1 (1.67.0) json (~> 1.4) - nokogiri (>= 1.4.4) + nokogiri (~> 1) diff-lcs (1.2.5) - json (1.8.3) - mini_portile (0.6.2) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - pg (0.17.1) + json (1.8.6) + mini_portile2 (2.3.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + pg (0.18.4) rake (10.4.2) rspec (3.2.0) rspec-core (~> 3.2.0) @@ -42,4 +42,4 @@ DEPENDENCIES rspec BUNDLED WITH - 1.10.5 + 1.16.0 diff --git a/lib/postgres_to_redshift.rb b/lib/postgres_to_redshift.rb index 65c9251..3f0fb5f 100644 --- a/lib/postgres_to_redshift.rb +++ b/lib/postgres_to_redshift.rb @@ -22,11 +22,17 @@ def self.update_tables update_tables = PostgresToRedshift.new update_tables.tables.each do |table| - target_connection.exec("CREATE TABLE IF NOT EXISTS #{schema}.#{target_connection.quote_ident(table.target_table_name)} (#{table.columns_for_create})") + begin + retries ||= 3 + target_connection.exec("CREATE TABLE IF NOT EXISTS #{schema}.#{target_connection.quote_ident(table.target_table_name)} (#{table.columns_for_create})") - update_tables.copy_table(table) + update_tables.copy_table(table) - update_tables.import_table(table) + update_tables.import_table(table) + rescue StandardError => e + retry unless retries += 1 < 3 + next + end end end diff --git a/lib/postgres_to_redshift/column.rb b/lib/postgres_to_redshift/column.rb index 2b3a13f..67c98fd 100644 --- a/lib/postgres_to_redshift/column.rb +++ b/lib/postgres_to_redshift/column.rb @@ -53,6 +53,9 @@ class PostgresToRedshift::Column "bytea" => "CHARACTER VARYING(65535)", "money" => "DECIMAL(19,2)", "oid" => "CHARACTER VARYING(65535)", + "uuid" => "CHARACTER VARYING(65535)", + "inet" => "CHARACTER VARYING(65535)", + "time without time zone" => "CHARACTER VARYING(65535)", "ARRAY" => "CHARACTER VARYING(65535)", "USER-DEFINED" => "CHARACTER VARYING(65535)", }