title: Writing nested schema to BigQuery from Dataflow (Python)
body: <p>I have a Dataflow job to write to BigQuery. It works well for non-nested schema, however fails for the nested schema.</p>
  
  <p>Here is my Dataflow pipeline:</p>
  
  <pre><code>pipeline_options = PipelineOptions()
    p = beam.Pipeline(options=pipeline_options)
  
    wordcount_options = pipeline_options.view_as(WordcountTemplatedOptions)
  
    schema = 'url: STRING,' \
             'ua: STRING,' \
             'method: STRING,' \
             'man: RECORD,' \
             'man.ip: RECORD,' \
             'man.ip.cc: STRING,' \
             'man.ip.city: STRING,' \
             'man.ip.as: INTEGER,' \
             'man.ip.country: STRING,' \
             'man.res: RECORD,' \
             'man.res.ip_dom: STRING'
  
    first = p | 'read' &gt;&gt; ReadFromText(wordcount_options.input)
    second = (first
              | 'process' &gt;&gt; (beam.ParDo(processFunction()))
              | 'write' &gt;&gt; beam.io.WriteToBigQuery(
                'myBucket:tableFolder.test_table',
                schema=schema)
    )
  </code></pre>
  
  <p>I created BigQuery Table using the following Schema is:</p>
  
  <pre><code>[
    {
      "mode": "NULLABLE",
      "name": "url",
      "type": "STRING"
    },
    {
      "mode": "NULLABLE",
      "name": "ua",
      "type": "STRING"
    },
    {
      "mode": "NULLABLE",
      "name": "method",
      "type": "STRING"
    },
    {
      "mode": "REPEATED",
      "name": "man",
      "type": "RECORD",
      "fields":
        [
          {
            "mode": "REPEATED",
            "name": "ip",
            "type": "RECORD",
            "fields":
              [
                {
                  "mode": "NULLABLE",
                  "name": "cc",
                  "type": "STRING"
                },
                {
                  "mode": "NULLABLE",
                  "name": "city",
                  "type": "STRING"
                },
                {
                  "mode": "NULLABLE",
                  "name": "as",
                  "type": "INTEGER"
                },
                {
                  "mode": "NULLABLE",
                  "name": "country",
                  "type": "STRING"
                }
              ]
          },
          {
            "mode": "REPEATED",
            "name": "res",
            "type": "RECORD",
            "fields":
              [
                {
                  "mode": "NULLABLE",
                  "name": "ip_dom",
                  "type": "STRING"
                }
              ]
          }
        ]
    }
  ]
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>BigQuery creation of import job for table "test_table" in dataset "tableFolder" in project "myBucket" failed., BigQuery execution failed., HTTP transport error:
   Message: Invalid value for: url is not a valid value
   HTTP Code: 400
  </code></pre>
  
  <p><strong>Question</strong>
  Can someone please guide me? What am I doing wrong?
  Also, If there is a better way to iterate through all the nested schema and write to BigQuery please suggest? </p>
  
  <p><strong>Additional info</strong>
  My data file:</p>
  
  <pre><code>{"url":"xyz.com","ua":"Mozilla/5.0 Chrome/63","method":"PUT","man":{"ip":{"cc":"IN","city":"delhi","as":274,"country":"States"},"res":{"ip_dom":"v1"}}}
  {"url":"xyz.com","ua":"Mozilla/5.0 Chrome/63","method":"PUT","man":{"ip":{"cc":"DK","city":"munlan","as":4865,"country":"United"},"res":{"ip_dom":"v1"}}}
  {"url":"xyz.com","ua":"Mozilla/5.0 Chrome/63","method":"GET","man":{"ip":{"cc":"BS","city":"sind","as":7655,"country":"India"},"res":{"ip_dom":"v1"}}}
  </code></pre>