title: Exception when reading BigQuery from Dataflow template using ValueProvider
body: <p>I'm trying to create a template to read from BigQuery, unfortunately I get an exception trying to build the template.</p>
  
  <blockquote>
    <p><strong>An exception occured while executing the Java class. Cannot call validate if table is dynamically set.</strong></p>
  </blockquote>
  
  <p>Reading <a href="https://cloud.google.com/dataflow/docs/guides/templates/creating-templates#pipeline-io-and-runtime-parameters" rel="nofollow noreferrer">the documentation</a>, it seems that there's a special function to call when reading BigQuery from batch template : </p>
  
  <blockquote>
    <p><strong>Note</strong>: If you want to run a batch pipeline that reads from BigQuery,
    you must use <strong>.withTemplateCompatibility()</strong> on all BigQuery reads.</p>
  </blockquote>
  
  <p>So, here's my code snippet :</p>
  
  <pre><code>PCollection&lt;Discount&gt; discountFromBigQuery = p.apply("Parse Discounts from BigQuery", BigQueryIO.read((SerializableFunction&lt;SchemaAndRecord, Discount&gt;) record -&gt; {
          GenericRecord row = record.getRecord();
          return new Discount(row);
      }).withTemplateCompatibility().from(options.getBigQueryDiscountPath()).withCoder(SerializableCoder.of(Discount.class)));
  </code></pre>
  
  <p>Obviously, <code>options.getBigQueryDiscountPath()</code> is a <code>ValueProvider&lt;String&gt;</code></p>
  
  <p>So, how can I get rid of this error and template the BigQuery reading part ?</p>
  
  <p>Here are the maven dependencies I use  :</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.apache.beam&lt;/groupId&gt;
      &lt;artifactId&gt;beam-sdks-java-core&lt;/artifactId&gt;
      &lt;version&gt;2.8.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.beam&lt;/groupId&gt;
      &lt;artifactId&gt;beam-sdks-java-io-google-cloud-platform&lt;/artifactId&gt;
      &lt;version&gt;2.8.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.google.cloud.dataflow&lt;/groupId&gt;
      &lt;artifactId&gt;google-cloud-dataflow-java-sdk-all&lt;/artifactId&gt;
      &lt;version&gt;2.5.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>