class_docstr: This handler handles connection and execution of the PostgreSQL with pgvector extension statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","PostgreSQL","with","pgvector","extension","statements","."]
docstr: Udate data into the pgvector table database.
docstr_tok: ["Udate","data","into","the","pgvector","table","database","."]
code: def update(
      self,
      table_name: str,
      data: pd.DataFrame,
      key_columns: List[str] = None,
  ):
      """
      Udate data into the pgvector table database.
      """
  
      where = None
      update_columns = {}
  
      for col in data.columns:
          value = Parameter("%s")
  
          if col in key_columns:
              cond = BinaryOperation(
                  op="=", args=[Identifier(col), value]
              )
              if where is None:
                  where = cond
              else:
                  where = BinaryOperation(op="AND", args=[where, cond])
          else:
              update_columns[col] = value
  
      query = Update(
          table=Identifier(table_name),
          update_columns=update_columns,
          where=where,
      )
  
      with self.connection.cursor() as cur:
          transposed_data = []
          for _, record in data.iterrows():
              row = [record[col] for col in update_columns.keys()]
              for key_column in key_columns:
                  row.append(record[key_column])
              transposed_data.append(row)
  
          query_str = self.renderer.get_string(query)
          cur.executemany(query_str, transposed_data)
          self.connection.commit()
  
imports: from collections import OrderedDict
  from typing import List, Union
  import pandas
  import psycopg
  from mindsdb_sql import ASTNode, Parameter, Identifier, Update, BinaryOperation
  from pgvector.psycopg import register_vector
  from mindsdb.integrations.handlers.postgres_handler.postgres_handler import PostgresHandler
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.libs.response import RESPONSE_TYPE
  from mindsdb.integrations.libs.response import HandlerResponse
  from mindsdb.integrations.libs.vectordatabase_handler import FilterCondition, VectorStoreHandler
  from mindsdb.utilities import log
  from mindsdb.utilities.profiler import profiler
label_desc: Use image node_id 10 for calling the PgVectorHandler obj's underlying member method code with example usage: obj.update(table_name, data, key_columns) without return types