Пример #1
0
  def replace(table, columns, values):
    """Replace one or more table rows.

    Args:
      table: Name of the table to be modified.
      columns: Name of the table columns to be modified.
      values: Values to be modified.
    """
    rows = len(values)
    cells = len(columns) * len(values)
    return _Mutator(
        mutation=Mutation(replace=batch._make_write_pb(table, columns, values)),
        operation=WriteMutation._OPERATION_REPLACE,
        rows=rows,
        cells=cells,
        kwargs={
            "table": table, "columns": columns, "values": values
        })
Пример #2
0
 def insert_or_update(table, columns, values):
   """Insert/update one or more table rows.
   Args:
     table: Name of the table to be modified.
     columns: Name of the table columns to be modified.
     values: Values to be modified.
   """
   rows = len(values)
   cells = len(columns) * len(values)
   return _Mutator(
       mutation=Mutation(
           insert_or_update=batch._make_write_pb(table, columns, values)),
       operation=WriteMutation._OPERATION_INSERT_OR_UPDATE,
       rows=rows,
       cells=cells,
       kwargs={
           "table": table, "columns": columns, "values": values
       })