Skip to content

Commit 530cd73

Browse files
authored
Merge pull request #8 from giwa/always-patch-description
2 parents f25e287 + 1c7bec0 commit 530cd73

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/embulk/output/bigquery.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,7 @@ def self.transaction(config, schema, task_count, &control)
399399
end
400400
end
401401

402-
if task['mode'] == 'append' || task['mode'] == 'append_direct'
403-
# update only column.description based on column_options
404-
bigquery.patch_table
405-
end
402+
bigquery.patch_table
406403

407404
ensure
408405
begin

test/test_transaction.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def test_delete_in_advance
9191
mock(obj).get_dataset(config['dataset'])
9292
mock(obj).delete_table_or_partition(config['table'])
9393
mock(obj).create_table_if_not_exists(config['table'])
94+
mock(obj).patch_table
9495
end
9596
Bigquery.transaction(config, schema, processor_count, &control)
9697
end
@@ -102,6 +103,7 @@ def test_delete_in_advance_with_partitioning
102103
mock(obj).get_dataset(config['dataset'])
103104
mock(obj).delete_table_or_partition(config['table'])
104105
mock(obj).create_table_if_not_exists(config['table'])
106+
mock(obj).patch_table
105107
end
106108
Bigquery.transaction(config, schema, processor_count, &control)
107109
end
@@ -117,6 +119,7 @@ def test_replace
117119
mock(obj).create_table_if_not_exists(config['table'])
118120
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
119121
mock(obj).delete_table(config['temp_table'])
122+
mock(obj).patch_table
120123
end
121124
Bigquery.transaction(config, schema, processor_count, &control)
122125
end
@@ -130,6 +133,7 @@ def test_replace_with_partitioning
130133
mock(obj).create_table_if_not_exists(config['table'])
131134
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
132135
mock(obj).delete_table(config['temp_table'])
136+
mock(obj).patch_table
133137
end
134138
Bigquery.transaction(config, schema, processor_count, &control)
135139
end
@@ -151,6 +155,7 @@ def test_replace_backup
151155

152156
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
153157
mock(obj).delete_table(config['temp_table'])
158+
mock(obj).patch_table
154159
end
155160
Bigquery.transaction(config, schema, processor_count, &control)
156161
end
@@ -170,6 +175,7 @@ def test_replace_backup_auto_create_dataset
170175

171176
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
172177
mock(obj).delete_table(config['temp_table'])
178+
mock(obj).patch_table
173179
end
174180
Bigquery.transaction(config, schema, processor_count, &control)
175181
end
@@ -189,6 +195,7 @@ def test_replace_backup_with_partitioning
189195

190196
mock(obj).copy(config['temp_table'], config['table'], write_disposition: 'WRITE_TRUNCATE')
191197
mock(obj).delete_table(config['temp_table'])
198+
mock(obj).patch_table
192199
end
193200
Bigquery.transaction(config, schema, processor_count, &control)
194201
end

0 commit comments

Comments
 (0)