title: Invalid Schema Update during patch operation on existing table in Google BigQuery via Google API Client
body: <p>I'm trying to update the schema of existing table using patch via ruby Google API Client. </p>
  
  <p>Here's the code:</p>
  
  <pre><code>    def updateTable(client, bq, schema,dataset,table)
          result = client.execute(:api_method =&gt;  bq.tables.patch,  
          :parameters =&gt; {'projectId' =&gt; PROJECT, 'datasetId' =&gt; dataset, 'tableId' =&gt; table},
          :body_object =&gt; {
                    "tableReference" =&gt; {
                      "datasetId" =&gt; dataset,
                      "projectId" =&gt; "mydataset-1",
                      "tableId"   =&gt; table
                    },
                    "schema" =&gt; schema
                  }
          )
          puts result.body    
  </code></pre>
  
  <p>end</p>
  
  <p>Here's the error I get:</p>
  
  <pre><code>    {
        "error": {
          "errors": [
            {
              "domain": "global",
              "reason": "invalid",
              "message": "Invalid schema update. Field a_b_testing_group is missing in new schema"
            }
         ],
          "code": 400,
         "message": "Invalid schema update. Field a_b_testing_group is missing in new schema"
  </code></pre>
  
  <p>}
  }</p>
  
  <p>I'll appreciate any pointers, suggestions.
  Thanks,</p>
  
  <p>Here's a sample schema:</p>
  
  <pre><code>{ "fields" : [
      { "fields" : [ 
          { "mode" : "NULLABLE",
            "name" : "time",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "attempts",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "mode",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "distinct_id",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "waited",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "party_size",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "version",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "region",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "reachability",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "device",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "_os",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "a_b_testing_group",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "item_name",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "price",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "contestant",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "mp_country_code",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "_city",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "_region",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "source",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "label",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "sku",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "balance__soft_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "balance__hard_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "price__soft_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "free",
            "type" : "BOOLEAN"
          },
          { "mode" : "NULLABLE",
            "name" : "price__hard_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "magical_damage_dealt",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "magical_damage_dealt__players_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "player_kills",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "damage_taken",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "duration",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "items_consumed",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "magical_damage_taken",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "physical_damage_dealt__players_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "disconnects",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "items_sold",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "physical_damage_taken",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "healing_done",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "matches",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "relic",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "assists",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "largest_kill_streak",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "bots",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "gold",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "largest_multi_kill",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "ping",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "team",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "tribute_kills",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "connects",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "deaths",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "shrine_captures",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "spawns",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "items_bought",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "physical_damage_dealt",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "abandoned",
            "type" : "BOOLEAN"
          },
          { "mode" : "NULLABLE",
            "name" : "damage_dealt",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "damage_dealt__players_",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "level",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "party_muted",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "quests_completed",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "tower_kills",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "victorious",
            "type" : "BOOLEAN"
          },
          { "mode" : "NULLABLE",
            "name" : "name",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "response",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "type",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "currency_type",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "state",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "last_quest",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "product",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "amount",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "platform",
            "type" : "STRING"
          },
          { "mode" : "NULLABLE",
            "name" : "newbie",
            "type" : "BOOLEAN"
          },
          { "mode" : "NULLABLE",
            "name" : "campaign_id",
            "type" : "FLOAT"
          },
          { "mode" : "NULLABLE",
            "name" : "delivery_id",
            "type" : "FLOAT"
          }
        ],
      "mode" : "NULLABLE",
      "name" : "properties",
      "type" : "RECORD"
    },
    { "mode" : "NULLABLE",
      "name" : "event",
      "type" : "STRING"
    }
  ] }
  </code></pre>