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 5, 2020
1 parent 1b25caf commit 8c632c2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ RUN apt-get update && apt-get install -y \
zlib1g-dev

# Install dependencies.


RUN python -m pip install --upgrade pip && \
python -m pip install --upgrade virtualenv && \
virtualenv /opt/gcp_variant_transforms/venv && \
Expand Down
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))
5 changes: 1 addition & 4 deletions gcp_variant_transforms/transforms/variant_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,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: 0 additions & 2 deletions gcp_variant_transforms/vcf_to_bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ def run(argv=None):
num_shards = 1

if known_args.output_table:
<<<<<<< HEAD
<<<<<<< HEAD
schema_file = tempfile.mkstemp(prefix=known_args.output_table,
suffix=_BQ_SCHEMA_FILE_SUFFIX)[1]
schema = (
Expand Down

0 comments on commit 8c632c2

Please sign in to comment.