From ad94e0ff4afa0302c4f5aeac9441420c9cc3396f Mon Sep 17 00:00:00 2001 From: Minero Aoki Date: Tue, 22 Aug 2017 20:31:48 +0900 Subject: [PATCH] fix: RedshiftConnector.foreach did not work with new exporter --- lib/redshift_connector/exporter.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/redshift_connector/exporter.rb b/lib/redshift_connector/exporter.rb index 2302157..e06eabf 100644 --- a/lib/redshift_connector/exporter.rb +++ b/lib/redshift_connector/exporter.rb @@ -28,11 +28,11 @@ def Exporter.for_query(**params) def Exporter.foreach(**params, &block) exporter = for_query(**params) + bundle = exporter.execute begin - exporter.execute - exporter.bundle.each_row(&block) + bundle.each_row(&block) ensure - exporter.bundle.clear + bundle.clear if bundle.respond_to?(:clear) end end end