Class: Google::Cloud::Spanner::V1::Mutation

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/spanner/v1/mutation.rb

Overview

A modification to one or more Cloud Spanner rows. Mutations can be applied to a Cloud Spanner database by sending them in a Commit call.

Defined Under Namespace

Classes: Delete, Write

Instance Attribute Summary collapse

Instance Attribute Details

#delete::Google::Cloud::Spanner::V1::Mutation::Delete

Returns Delete rows from a table. Succeeds whether or not the named rows were present.

Returns:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/spanner/v1/mutation.rb', line 59

class Mutation
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#insert insert}, {::Google::Cloud::Spanner::V1::Mutation#update update}, {::Google::Cloud::Spanner::V1::Mutation#insert_or_update insert_or_update}, and
  # {::Google::Cloud::Spanner::V1::Mutation#replace replace} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be written.
  # @!attribute [rw] columns
  #   @return [::Array<::String>]
  #     The names of the columns in {::Google::Cloud::Spanner::V1::Mutation::Write#table table} to be written.
  #
  #     The list of columns must contain enough columns to allow
  #     Cloud Spanner to derive values for all primary key columns in the
  #     row(s) to be modified.
  # @!attribute [rw] values
  #   @return [::Array<::Google::Protobuf::ListValue>]
  #     The values to be written. `values` can contain more than one
  #     list of values. If it does, then multiple rows are written, one
  #     for each entry in `values`. Each list in `values` must have
  #     exactly as many entries as there are entries in {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}
  #     above. Sending multiple lists is equivalent to sending multiple
  #     `Mutation`s, each containing one `values` entry and repeating
  #     {::Google::Cloud::Spanner::V1::Mutation::Write#table table} and {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
  #     encoded as described {::Google::Cloud::Spanner::V1::TypeCode here}.
  class Write
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#delete delete} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be deleted.
  # @!attribute [rw] key_set
  #   @return [::Google::Cloud::Spanner::V1::KeySet]
  #     Required. The primary keys of the rows within {::Google::Cloud::Spanner::V1::Mutation::Delete#table table} to delete.  The
  #     primary keys must be specified in the order in which they appear in the
  #     `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
  #     statement used to create the table).
  #     Delete is idempotent. The transaction will succeed even if some or all
  #     rows do not exist.
  class Delete
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#insert::Google::Cloud::Spanner::V1::Mutation::Write

Returns Insert new rows in a table. If any of the rows already exist, the write or transaction fails with error ALREADY_EXISTS.

Returns:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/spanner/v1/mutation.rb', line 59

class Mutation
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#insert insert}, {::Google::Cloud::Spanner::V1::Mutation#update update}, {::Google::Cloud::Spanner::V1::Mutation#insert_or_update insert_or_update}, and
  # {::Google::Cloud::Spanner::V1::Mutation#replace replace} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be written.
  # @!attribute [rw] columns
  #   @return [::Array<::String>]
  #     The names of the columns in {::Google::Cloud::Spanner::V1::Mutation::Write#table table} to be written.
  #
  #     The list of columns must contain enough columns to allow
  #     Cloud Spanner to derive values for all primary key columns in the
  #     row(s) to be modified.
  # @!attribute [rw] values
  #   @return [::Array<::Google::Protobuf::ListValue>]
  #     The values to be written. `values` can contain more than one
  #     list of values. If it does, then multiple rows are written, one
  #     for each entry in `values`. Each list in `values` must have
  #     exactly as many entries as there are entries in {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}
  #     above. Sending multiple lists is equivalent to sending multiple
  #     `Mutation`s, each containing one `values` entry and repeating
  #     {::Google::Cloud::Spanner::V1::Mutation::Write#table table} and {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
  #     encoded as described {::Google::Cloud::Spanner::V1::TypeCode here}.
  class Write
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#delete delete} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be deleted.
  # @!attribute [rw] key_set
  #   @return [::Google::Cloud::Spanner::V1::KeySet]
  #     Required. The primary keys of the rows within {::Google::Cloud::Spanner::V1::Mutation::Delete#table table} to delete.  The
  #     primary keys must be specified in the order in which they appear in the
  #     `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
  #     statement used to create the table).
  #     Delete is idempotent. The transaction will succeed even if some or all
  #     rows do not exist.
  class Delete
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#insert_or_update::Google::Cloud::Spanner::V1::Mutation::Write

Returns Like insert, except that if the row already exists, then its column values are overwritten with the ones provided. Any column values not explicitly written are preserved.

When using insert_or_update, just as when using insert, all NOT NULL columns in the table must be given a value. This holds true even when the row already exists and will therefore actually be updated.

Returns:

  • (::Google::Cloud::Spanner::V1::Mutation::Write)

    Like insert, except that if the row already exists, then its column values are overwritten with the ones provided. Any column values not explicitly written are preserved.

    When using insert_or_update, just as when using insert, all NOT NULL columns in the table must be given a value. This holds true even when the row already exists and will therefore actually be updated.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/spanner/v1/mutation.rb', line 59

class Mutation
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#insert insert}, {::Google::Cloud::Spanner::V1::Mutation#update update}, {::Google::Cloud::Spanner::V1::Mutation#insert_or_update insert_or_update}, and
  # {::Google::Cloud::Spanner::V1::Mutation#replace replace} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be written.
  # @!attribute [rw] columns
  #   @return [::Array<::String>]
  #     The names of the columns in {::Google::Cloud::Spanner::V1::Mutation::Write#table table} to be written.
  #
  #     The list of columns must contain enough columns to allow
  #     Cloud Spanner to derive values for all primary key columns in the
  #     row(s) to be modified.
  # @!attribute [rw] values
  #   @return [::Array<::Google::Protobuf::ListValue>]
  #     The values to be written. `values` can contain more than one
  #     list of values. If it does, then multiple rows are written, one
  #     for each entry in `values`. Each list in `values` must have
  #     exactly as many entries as there are entries in {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}
  #     above. Sending multiple lists is equivalent to sending multiple
  #     `Mutation`s, each containing one `values` entry and repeating
  #     {::Google::Cloud::Spanner::V1::Mutation::Write#table table} and {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
  #     encoded as described {::Google::Cloud::Spanner::V1::TypeCode here}.
  class Write
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#delete delete} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be deleted.
  # @!attribute [rw] key_set
  #   @return [::Google::Cloud::Spanner::V1::KeySet]
  #     Required. The primary keys of the rows within {::Google::Cloud::Spanner::V1::Mutation::Delete#table table} to delete.  The
  #     primary keys must be specified in the order in which they appear in the
  #     `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
  #     statement used to create the table).
  #     Delete is idempotent. The transaction will succeed even if some or all
  #     rows do not exist.
  class Delete
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#replace::Google::Cloud::Spanner::V1::Mutation::Write

Returns Like insert, except that if the row already exists, it is deleted, and the column values provided are inserted instead. Unlike insert_or_update, this means any values not explicitly written become NULL.

In an interleaved table, if you create the child table with the ON DELETE CASCADE annotation, then replacing a parent row also deletes the child rows. Otherwise, you must delete the child rows before you replace the parent row.

Returns:

  • (::Google::Cloud::Spanner::V1::Mutation::Write)

    Like insert, except that if the row already exists, it is deleted, and the column values provided are inserted instead. Unlike insert_or_update, this means any values not explicitly written become NULL.

    In an interleaved table, if you create the child table with the ON DELETE CASCADE annotation, then replacing a parent row also deletes the child rows. Otherwise, you must delete the child rows before you replace the parent row.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/spanner/v1/mutation.rb', line 59

class Mutation
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#insert insert}, {::Google::Cloud::Spanner::V1::Mutation#update update}, {::Google::Cloud::Spanner::V1::Mutation#insert_or_update insert_or_update}, and
  # {::Google::Cloud::Spanner::V1::Mutation#replace replace} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be written.
  # @!attribute [rw] columns
  #   @return [::Array<::String>]
  #     The names of the columns in {::Google::Cloud::Spanner::V1::Mutation::Write#table table} to be written.
  #
  #     The list of columns must contain enough columns to allow
  #     Cloud Spanner to derive values for all primary key columns in the
  #     row(s) to be modified.
  # @!attribute [rw] values
  #   @return [::Array<::Google::Protobuf::ListValue>]
  #     The values to be written. `values` can contain more than one
  #     list of values. If it does, then multiple rows are written, one
  #     for each entry in `values`. Each list in `values` must have
  #     exactly as many entries as there are entries in {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}
  #     above. Sending multiple lists is equivalent to sending multiple
  #     `Mutation`s, each containing one `values` entry and repeating
  #     {::Google::Cloud::Spanner::V1::Mutation::Write#table table} and {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
  #     encoded as described {::Google::Cloud::Spanner::V1::TypeCode here}.
  class Write
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#delete delete} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be deleted.
  # @!attribute [rw] key_set
  #   @return [::Google::Cloud::Spanner::V1::KeySet]
  #     Required. The primary keys of the rows within {::Google::Cloud::Spanner::V1::Mutation::Delete#table table} to delete.  The
  #     primary keys must be specified in the order in which they appear in the
  #     `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
  #     statement used to create the table).
  #     Delete is idempotent. The transaction will succeed even if some or all
  #     rows do not exist.
  class Delete
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#update::Google::Cloud::Spanner::V1::Mutation::Write

Returns Update existing rows in a table. If any of the rows does not already exist, the transaction fails with error NOT_FOUND.

Returns:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/spanner/v1/mutation.rb', line 59

class Mutation
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#insert insert}, {::Google::Cloud::Spanner::V1::Mutation#update update}, {::Google::Cloud::Spanner::V1::Mutation#insert_or_update insert_or_update}, and
  # {::Google::Cloud::Spanner::V1::Mutation#replace replace} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be written.
  # @!attribute [rw] columns
  #   @return [::Array<::String>]
  #     The names of the columns in {::Google::Cloud::Spanner::V1::Mutation::Write#table table} to be written.
  #
  #     The list of columns must contain enough columns to allow
  #     Cloud Spanner to derive values for all primary key columns in the
  #     row(s) to be modified.
  # @!attribute [rw] values
  #   @return [::Array<::Google::Protobuf::ListValue>]
  #     The values to be written. `values` can contain more than one
  #     list of values. If it does, then multiple rows are written, one
  #     for each entry in `values`. Each list in `values` must have
  #     exactly as many entries as there are entries in {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}
  #     above. Sending multiple lists is equivalent to sending multiple
  #     `Mutation`s, each containing one `values` entry and repeating
  #     {::Google::Cloud::Spanner::V1::Mutation::Write#table table} and {::Google::Cloud::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
  #     encoded as described {::Google::Cloud::Spanner::V1::TypeCode here}.
  class Write
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Arguments to {::Google::Cloud::Spanner::V1::Mutation#delete delete} operations.
  # @!attribute [rw] table
  #   @return [::String]
  #     Required. The table whose rows will be deleted.
  # @!attribute [rw] key_set
  #   @return [::Google::Cloud::Spanner::V1::KeySet]
  #     Required. The primary keys of the rows within {::Google::Cloud::Spanner::V1::Mutation::Delete#table table} to delete.  The
  #     primary keys must be specified in the order in which they appear in the
  #     `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
  #     statement used to create the table).
  #     Delete is idempotent. The transaction will succeed even if some or all
  #     rows do not exist.
  class Delete
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end