diff --git a/lib/etl/control/destination/file_destination.rb b/lib/etl/control/destination/file_destination.rb index e1884fa..4d3d66d 100644 --- a/lib/etl/control/destination/file_destination.rb +++ b/lib/etl/control/destination/file_destination.rb @@ -93,7 +93,7 @@ def flush end # write the values joined by the separator defined in the configuration - f.write(values.join(separator)) + f.write(values.join(separator).force_encoding("UTF-8")) # write the end-of-line f.write(eol) diff --git a/lib/etl/control/source/database_source.rb b/lib/etl/control/source/database_source.rb index 71bb45b..6527ee4 100644 --- a/lib/etl/control/source/database_source.rb +++ b/lib/etl/control/source/database_source.rb @@ -75,6 +75,11 @@ def order configuration[:order] end + # Get the with clause for the query, defaults to nil + def with + configuration[:with] + end + # Return the column which is used for in the where clause to identify # new rows def new_records_only @@ -169,7 +174,9 @@ def write_local(file) # Get the query to use def query return @query if @query - q = "SELECT #{select} FROM #{@table}" + q = '' + q << "#{with}" if with + q << "SELECT #{select} FROM #{@table}" q << " #{join}" if join conditions = []