Skip to content

Commit 0d69f80

Browse files
committed
Remove WRITE_TRUNCATE option when writing to BQ.
1 parent d7c4271 commit 0d69f80

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

gcp_variant_transforms/transforms/sample_info_to_bigquery.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,11 @@ def __init__(self, output_table_prefix, sample_name_encoding, append=False):
7373
def expand(self, pcoll):
7474
return (pcoll
7575
| 'ConvertSampleInfoToBigQueryTableRow' >> beam.ParDo(
76-
ConvertSampleInfoToRow(self._sample_name_encoding))
77-
| 'WriteSampleInfoToBigQuery' >> beam.io.Write(beam.io.BigQuerySink(
76+
ConvertSampleInfoToRow(self.sample_name_encoding))
77+
| 'WriteSampleInfoToBigQuery' >> beam.io.WriteToBigQuery(
7878
self._output_table,
7979
schema=self._schema,
8080
create_disposition=(
8181
beam.io.BigQueryDisposition.CREATE_IF_NEEDED),
82-
write_disposition=(
83-
beam.io.BigQueryDisposition.WRITE_APPEND
84-
if self._append
85-
else beam.io.BigQueryDisposition.WRITE_TRUNCATE),
82+
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
8683
method=beam.io.WriteToBigQuery.Method.FILE_LOADS))

gcp_variant_transforms/transforms/variant_to_bigquery.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ def __init__(
6363
update_schema_on_append=False, # type: bool
6464
allow_incompatible_records=False, # type: bool
6565
omit_empty_sample_calls=False, # type: bool
66-
null_numeric_value_replacement=None # type: int,
67-
66+
null_numeric_value_replacement=None # type: int
6867
):
6968
# type: (...) -> None
7069
"""Initializes the transform.
@@ -115,8 +114,5 @@ def expand(self, pcoll):
115114
schema=self._schema,
116115
create_disposition=(
117116
beam.io.BigQueryDisposition.CREATE_IF_NEEDED),
118-
write_disposition=(
119-
beam.io.BigQueryDisposition.WRITE_APPEND
120-
if self._append
121-
else beam.io.BigQueryDisposition.WRITE_TRUNCATE),
117+
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
122118
method=beam.io.WriteToBigQuery.Method.FILE_LOADS))

gcp_variant_transforms/vcf_to_bq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def _run_annotation_pipeline(known_args, pipeline_args):
389389

390390
def _create_sample_info_table(pipeline, # type: beam.Pipeline
391391
pipeline_mode, # type: PipelineModes
392-
known_args, # type: argparse.Namespace,
392+
known_args # type: argparse.Namespace
393393
):
394394
# type: (...) -> None
395395
headers = pipeline_common.read_headers(

0 commit comments

Comments
 (0)