title: Beam Python Dataflow Runner Uses deprecated BigQuerySink instead of WriteToBigQuery in apply_WriteToBigQuery
body: <p>In terms of implementation details within the DataflowRunner, a lot of people may not care about whether <code>BigQuerySink</code> or <code>WriteToBigQuery</code> is used.</p>
  
  <p>However, in my case I am trying to deploy my code to dataflow templates with RunTimeValueProvider's for the arguments. This behavior is supported in <code>WriteToBigQuery</code>:</p>
  
  <pre><code>class WriteToBigQuery(PTransform):
  ....
  
   table (str, callable, ValueProvider): The ID of the table, or a callable
           that returns it. The ID must contain only letters ``a-z``, ``A-Z``,
           numbers ``0-9``, or underscores ``_``. If dataset argument is
           :data:`None` then the table argument must contain the entire table
           reference specified as: ``'DATASET.TABLE'``
           or ``'PROJECT:DATASET.TABLE'``. If it's a callable, it must receive one
           argument representing an element to be written to BigQuery, and return
           a TableReference, or a string table name as specified above.
           Multiple destinations are only supported on Batch pipelines at the
           moment.
  </code></pre>
  
  <p>It is <strong>not</strong> supported in BigQuerySink:</p>
  
  <pre><code>class BigQuerySink(dataflow_io.NativeSink):
        table (str): The ID of the table. The ID must contain only letters
          ``a-z``, ``A-Z``, numbers ``0-9``, or underscores ``_``. If
          **dataset** argument is :data:`None` then the table argument must
          contain the entire table reference specified as: ``'DATASET.TABLE'`` or
          ``'PROJECT:DATASET.TABLE'``.
  </code></pre>
  
  <p>What's even more fun is that <code>BigQuerySink</code> in the code has been deprecated since 2.11.0.</p>
  
  <pre><code>@deprecated(since='2.11.0', current="WriteToBigQuery")
  </code></pre>
  
  <p>However in DataFlowRunner, the current code and comments seem completely out of line with the expectation that <code>WriteToBigQuery</code> is the default class to use over <code>BigQuerySink</code>:</p>
  
  <pre><code>  def apply_WriteToBigQuery(self, transform, pcoll, options):
      # Make sure this is the WriteToBigQuery class that we expected, and that
      # users did not specifically request the new BQ sink by passing experiment
      # flag.
  
      # TODO(BEAM-6928): Remove this function for release 2.14.0.
      experiments = options.view_as(DebugOptions).experiments or []
      if (not isinstance(transform, beam.io.WriteToBigQuery)
          or 'use_beam_bq_sink' in experiments):
        return self.apply_PTransform(transform, pcoll, options)
      if transform.schema == beam.io.gcp.bigquery.SCHEMA_AUTODETECT:
        raise RuntimeError(
            'Schema auto-detection is not supported on the native sink')
      standard_options = options.view_as(StandardOptions)
      if standard_options.streaming:
        if (transform.write_disposition ==
            beam.io.BigQueryDisposition.WRITE_TRUNCATE):
          raise RuntimeError('Can not use write truncation mode in streaming')
        return self.apply_PTransform(transform, pcoll, options)
      else:
        from apache_beam.io.gcp.bigquery_tools import parse_table_schema_from_json
        schema = None
        if transform.schema:
          schema = parse_table_schema_from_json(json.dumps(transform.schema))
        return pcoll  | 'WriteToBigQuery' &gt;&gt; beam.io.Write(
            beam.io.BigQuerySink(
                transform.table_reference.tableId,
                transform.table_reference.datasetId,
                transform.table_reference.projectId,
                schema,
                transform.create_disposition,
                transform.write_disposition,
                kms_key=transform.kms_key))
  </code></pre>
  
  <p>My questions are twofold:</p>
  
  <ol>
  <li>Why the difference in contract/expectations between the <code>DataflowRunner</code> and the <code>io.BigQuery</code> class?</li>
  <li>Without waiting for a bug fix, does anyone have suggestions on how to <em>force</em> the <code>DataflowRunner</code> to use <code>WriteToBigQuery</code> over <code>BigQuerySink</code>?</li>
  </ol>