Skip to content

Commit

Permalink
Remove WRITE_TRUNCATE option when writing to BQ.
Browse files Browse the repository at this point in the history
  • Loading branch information
tneymanov committed Feb 10, 2020
1 parent d7c4271 commit 0d69f80
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
9 changes: 3 additions & 6 deletions gcp_variant_transforms/transforms/sample_info_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,11 @@ def __init__(self, output_table_prefix, sample_name_encoding, append=False):
def expand(self, pcoll):
return (pcoll
| 'ConvertSampleInfoToBigQueryTableRow' >> beam.ParDo(
ConvertSampleInfoToRow(self._sample_name_encoding))
| 'WriteSampleInfoToBigQuery' >> beam.io.Write(beam.io.BigQuerySink(
ConvertSampleInfoToRow(self.sample_name_encoding))
| 'WriteSampleInfoToBigQuery' >> beam.io.WriteToBigQuery(
self._output_table,
schema=self._schema,
create_disposition=(
beam.io.BigQueryDisposition.CREATE_IF_NEEDED),
write_disposition=(
beam.io.BigQueryDisposition.WRITE_APPEND
if self._append
else beam.io.BigQueryDisposition.WRITE_TRUNCATE),
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
method=beam.io.WriteToBigQuery.Method.FILE_LOADS))
8 changes: 2 additions & 6 deletions gcp_variant_transforms/transforms/variant_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def __init__(
update_schema_on_append=False, # type: bool
allow_incompatible_records=False, # type: bool
omit_empty_sample_calls=False, # type: bool
null_numeric_value_replacement=None # type: int,

null_numeric_value_replacement=None # type: int
):
# type: (...) -> None
"""Initializes the transform.
Expand Down Expand Up @@ -115,8 +114,5 @@ def expand(self, pcoll):
schema=self._schema,
create_disposition=(
beam.io.BigQueryDisposition.CREATE_IF_NEEDED),
write_disposition=(
beam.io.BigQueryDisposition.WRITE_APPEND
if self._append
else beam.io.BigQueryDisposition.WRITE_TRUNCATE),
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
method=beam.io.WriteToBigQuery.Method.FILE_LOADS))
2 changes: 1 addition & 1 deletion gcp_variant_transforms/vcf_to_bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def _run_annotation_pipeline(known_args, pipeline_args):

def _create_sample_info_table(pipeline, # type: beam.Pipeline
pipeline_mode, # type: PipelineModes
known_args, # type: argparse.Namespace,
known_args # type: argparse.Namespace
):
# type: (...) -> None
headers = pipeline_common.read_headers(
Expand Down

0 comments on commit 0d69f80

Please sign in to comment.