Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Forcing UTF-8 encoding and adding support for 'with' clause #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/etl/control/destination/file_destination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion lib/etl/control/source/database_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = []
Expand Down