class_docstr: Implementation for the emails table for Gmail
class_docstr_tok: ["Implementation","for","the","emails","table","for","Gmail"]
docstr: Updates a label of a message.
  
  Args:
      query (ASTNode): The SQL query to parse.
  
  Raises:
      NotImplementedError: If the query contains an unsupported condition.
docstr_tok: ["Updates","a","label","of","a","message",".","Args",":","query","(","ASTNode",")",":","The","SQL","query","to","parse",".","Raises",":","NotImplementedError",":","If","the","query","contains","an","unsupported","condition","."]
code: def update(self, query: ast.Update) -> None:
      """Updates a label of a message.
  
      Args:
          query (ASTNode): The SQL query to parse.
  
      Raises:
          NotImplementedError: If the query contains an unsupported condition.
      """
      params = {}
      conditions = extract_comparison_conditions(query.where)
      for op, arg1, arg2 in conditions:
          if op == "or":
              raise NotImplementedError(f"OR is not supported")
          if arg1 == "id":
              if op == "=":
                  params["id"] = arg2
              else:
                  raise NotImplementedError(f"Unknown op: {op}")
          else:
              raise NotImplementedError(f"Unknown clause: {arg1}")
      request_body = {}
      values = query.update_columns.items()
      data_list = list(values)
      add_label = []
      remove_label = []
      for key, value in data_list:
          if key == "addLabel":
              add_label.append(str(value)[1:-1])
          elif key == "removeLabel":
              remove_label.append(str(value)[1:-1])
          else:
              raise NotImplementedError(f"Unknown clause: {key}")
      if add_label:
          request_body["addLabelIds"] = add_label
      if remove_label:
          request_body["removeLabelIds"] = remove_label
      params["body"] = request_body
      self.handler.call_gmail_api("update_message", params)
  
imports: import json
  from shutil import copyfile
  from collections import OrderedDict
  import requests
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from mindsdb.integrations.libs.api_handler import APIHandler, APITable
  from mindsdb_sql.parser import ast
  from mindsdb.utilities import log
  from mindsdb_sql import parse_sql
  from mindsdb.utilities.config import Config
  import os
  import time
  from typing import List
  import pandas
  from google.auth.transport.requests import Request
  from google.oauth2.credentials import Credentials
  from google_auth_oauthlib.flow import Flow
  from googleapiclient.discovery import build
  from googleapiclient.errors import HttpError
  from email.message import EmailMessage
  from base64 import urlsafe_b64encode, urlsafe_b64decode
  from .utils import AuthException, google_auth_flow, save_creds_to_file
label_desc: Use image node_id 5 for calling the EmailsTable obj's underlying member method code with example usage: obj.update(query) without return types