Skip to content

Commit 53c9255

Browse files
Merge pull request #2 from YujiKoyano/bug-fix/access-rows-with-symbol
add-method-converting-string-to-symbol
2 parents f82ded1 + eb8436a commit 53c9255

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/embulk/input/bigquery.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def run
4343
bq = Google::Cloud::Bigquery.new(project: @task[:project], keyfile: @task[:keyfile])
4444
params = @task[:params]
4545
rows = bq.query(@task[:sql])
46+
47+
@task[:columns] = values_to_sym(@task[:columns], 'name')
48+
4649
rows.each do |row|
4750
columns = []
4851
@task[:columns].each do |c|
@@ -58,6 +61,13 @@ def run
5861
@page_builder.finish
5962
return {}
6063
end
64+
65+
def values_to_sym(hashs, key)
66+
hashs.map do |h|
67+
h[key] = h[key].to_sym
68+
h
69+
end
70+
end
6171
end
6272
end
6373
end

0 commit comments

Comments
 (0)