google-cloud-spanner 1.15.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +49 -0
  4. data/CONTRIBUTING.md +5 -5
  5. data/TROUBLESHOOTING.md +0 -6
  6. data/lib/google-cloud-spanner.rb +10 -13
  7. data/lib/google/cloud/spanner.rb +6 -8
  8. data/lib/google/cloud/spanner/admin/database/credentials.rb +2 -2
  9. data/lib/google/cloud/spanner/admin/instance/credentials.rb +2 -2
  10. data/lib/google/cloud/spanner/backup.rb +315 -0
  11. data/lib/google/cloud/spanner/backup/job.rb +274 -0
  12. data/lib/google/cloud/spanner/backup/job/list.rb +177 -0
  13. data/lib/google/cloud/spanner/backup/list.rb +169 -0
  14. data/lib/google/cloud/spanner/backup/restore/job.rb +246 -0
  15. data/lib/google/cloud/spanner/batch_client.rb +2 -2
  16. data/lib/google/cloud/spanner/batch_snapshot.rb +120 -23
  17. data/lib/google/cloud/spanner/batch_update.rb +1 -1
  18. data/lib/google/cloud/spanner/client.rb +189 -30
  19. data/lib/google/cloud/spanner/commit.rb +14 -14
  20. data/lib/google/cloud/spanner/convert.rb +7 -7
  21. data/lib/google/cloud/spanner/credentials.rb +2 -2
  22. data/lib/google/cloud/spanner/data.rb +2 -2
  23. data/lib/google/cloud/spanner/database.rb +275 -15
  24. data/lib/google/cloud/spanner/database/backup_info.rb +105 -0
  25. data/lib/google/cloud/spanner/database/job.rb +5 -2
  26. data/lib/google/cloud/spanner/database/job/list.rb +177 -0
  27. data/lib/google/cloud/spanner/database/list.rb +1 -1
  28. data/lib/google/cloud/spanner/database/restore_info.rb +63 -0
  29. data/lib/google/cloud/spanner/fields.rb +8 -8
  30. data/lib/google/cloud/spanner/instance.rb +401 -8
  31. data/lib/google/cloud/spanner/instance/config.rb +1 -1
  32. data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
  33. data/lib/google/cloud/spanner/instance/job.rb +2 -2
  34. data/lib/google/cloud/spanner/instance/list.rb +1 -1
  35. data/lib/google/cloud/spanner/partition.rb +4 -4
  36. data/lib/google/cloud/spanner/policy.rb +2 -2
  37. data/lib/google/cloud/spanner/results.rb +9 -6
  38. data/lib/google/cloud/spanner/service.rb +392 -302
  39. data/lib/google/cloud/spanner/session.rb +186 -31
  40. data/lib/google/cloud/spanner/snapshot.rb +60 -6
  41. data/lib/google/cloud/spanner/transaction.rb +116 -10
  42. data/lib/google/cloud/spanner/version.rb +1 -1
  43. metadata +28 -109
  44. data/lib/google/cloud/spanner/admin/database.rb +0 -149
  45. data/lib/google/cloud/spanner/admin/database/v1.rb +0 -147
  46. data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +0 -46
  47. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +0 -1513
  48. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +0 -111
  49. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  50. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/options.rb +0 -33
  51. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +0 -151
  52. data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +0 -51
  53. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +0 -131
  54. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +0 -29
  55. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +0 -222
  56. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +0 -113
  57. data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +0 -39
  58. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +0 -325
  59. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +0 -368
  60. data/lib/google/cloud/spanner/admin/database/v1/doc/google/type/expr.rb +0 -45
  61. data/lib/google/cloud/spanner/admin/instance.rb +0 -164
  62. data/lib/google/cloud/spanner/admin/instance/v1.rb +0 -162
  63. data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +0 -46
  64. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  65. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/options.rb +0 -33
  66. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +0 -151
  67. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +0 -51
  68. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +0 -131
  69. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +0 -29
  70. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +0 -222
  71. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +0 -39
  72. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +0 -334
  73. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb +0 -45
  74. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +0 -975
  75. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +0 -76
  76. data/lib/google/cloud/spanner/v1.rb +0 -16
  77. data/lib/google/cloud/spanner/v1/credentials.rb +0 -42
  78. data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +0 -131
  79. data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +0 -91
  80. data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +0 -29
  81. data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +0 -74
  82. data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +0 -113
  83. data/lib/google/cloud/spanner/v1/doc/google/rpc/status.rb +0 -39
  84. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +0 -150
  85. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +0 -95
  86. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +0 -121
  87. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +0 -190
  88. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +0 -570
  89. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +0 -432
  90. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +0 -112
  91. data/lib/google/cloud/spanner/v1/spanner_client.rb +0 -1485
  92. data/lib/google/cloud/spanner/v1/spanner_client_config.json +0 -121
  93. data/lib/google/spanner/admin/database/v1/backup_pb.rb +0 -98
  94. data/lib/google/spanner/admin/database/v1/common_pb.rb +0 -28
  95. data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +0 -141
  96. data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +0 -169
  97. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +0 -125
  98. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +0 -181
  99. data/lib/google/spanner/v1/keys_pb.rb +0 -34
  100. data/lib/google/spanner/v1/mutation_pb.rb +0 -39
  101. data/lib/google/spanner/v1/query_plan_pb.rb +0 -48
  102. data/lib/google/spanner/v1/result_set_pb.rb +0 -48
  103. data/lib/google/spanner/v1/spanner_pb.rb +0 -179
  104. data/lib/google/spanner/v1/spanner_services_pb.rb +0 -179
  105. data/lib/google/spanner/v1/transaction_pb.rb +0 -56
  106. data/lib/google/spanner/v1/type_pb.rb +0 -44
@@ -1,113 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone or local
19
- # calendar, encoded as a count of seconds and fractions of seconds at
20
- # nanosecond resolution. The count is relative to an epoch at UTC midnight on
21
- # January 1, 1970, in the proleptic Gregorian calendar which extends the
22
- # Gregorian calendar backwards to year one.
23
- #
24
- # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
25
- # second table is needed for interpretation, using a [24-hour linear
26
- # smear](https://developers.google.com/time/smear).
27
- #
28
- # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
29
- # restricting to that range, we ensure that we can convert to and from [RFC
30
- # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
31
- #
32
- # = Examples
33
- #
34
- # Example 1: Compute Timestamp from POSIX `time()`.
35
- #
36
- # Timestamp timestamp;
37
- # timestamp.set_seconds(time(NULL));
38
- # timestamp.set_nanos(0);
39
- #
40
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
41
- #
42
- # struct timeval tv;
43
- # gettimeofday(&tv, NULL);
44
- #
45
- # Timestamp timestamp;
46
- # timestamp.set_seconds(tv.tv_sec);
47
- # timestamp.set_nanos(tv.tv_usec * 1000);
48
- #
49
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
50
- #
51
- # FILETIME ft;
52
- # GetSystemTimeAsFileTime(&ft);
53
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
54
- #
55
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
56
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
57
- # Timestamp timestamp;
58
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
59
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
60
- #
61
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
62
- #
63
- # long millis = System.currentTimeMillis();
64
- #
65
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
66
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
67
- #
68
- #
69
- # Example 5: Compute Timestamp from current time in Python.
70
- #
71
- # timestamp = Timestamp()
72
- # timestamp.GetCurrentTime()
73
- #
74
- # = JSON Mapping
75
- #
76
- # In JSON format, the Timestamp type is encoded as a string in the
77
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
- # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
79
- # where \\{year} is always expressed using four digits while \\{month}, \\{day},
80
- # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
81
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
84
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
85
- # able to accept both UTC and other timezones (as indicated by an offset).
86
- #
87
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
- # 01:30 UTC on January 15, 2017.
89
- #
90
- # In JavaScript, one can convert a Date object to this format using the
91
- # standard
92
- # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
- # method. In Python, a standard `datetime.datetime` object can be converted
94
- # to this format using
95
- # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
- # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
- # the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
99
- # ) to obtain a formatter capable of generating timestamps in this format.
100
- # @!attribute [rw] seconds
101
- # @return [Integer]
102
- # Represents seconds of UTC time since Unix epoch
103
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
104
- # 9999-12-31T23:59:59Z inclusive.
105
- # @!attribute [rw] nanos
106
- # @return [Integer]
107
- # Non-negative fractions of a second at nanosecond resolution. Negative
108
- # second values with fractions must still have non-negative nanos values
109
- # that count forward in time. Must be from 0 to 999,999,999
110
- # inclusive.
111
- class Timestamp; end
112
- end
113
- end
@@ -1,39 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Rpc
18
- # The `Status` type defines a logical error model that is suitable for
19
- # different programming environments, including REST APIs and RPC APIs. It is
20
- # used by [gRPC](https://github.com/grpc). Each `Status` message contains
21
- # three pieces of data: error code, error message, and error details.
22
- #
23
- # You can find out more about this error model and how to work with it in the
24
- # [API Design Guide](https://cloud.google.com/apis/design/errors).
25
- # @!attribute [rw] code
26
- # @return [Integer]
27
- # The status code, which should be an enum value of {Google::Rpc::Code}.
28
- # @!attribute [rw] message
29
- # @return [String]
30
- # A developer-facing error message, which should be in English. Any
31
- # user-facing error message should be localized and sent in the
32
- # {Google::Rpc::Status#details} field, or localized by the client.
33
- # @!attribute [rw] details
34
- # @return [Array<Google::Protobuf::Any>]
35
- # A list of messages that carry the error details. There is a common set of
36
- # message types for APIs to use.
37
- class Status; end
38
- end
39
- end
@@ -1,150 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Spanner
18
- module V1
19
- # KeyRange represents a range of rows in a table or index.
20
- #
21
- # A range has a start key and an end key. These keys can be open or
22
- # closed, indicating if the range includes rows with that key.
23
- #
24
- # Keys are represented by lists, where the ith value in the list
25
- # corresponds to the ith component of the table or index primary key.
26
- # Individual values are encoded as described
27
- # {Google::Spanner::V1::TypeCode here}.
28
- #
29
- # For example, consider the following table definition:
30
- #
31
- # CREATE TABLE UserEvents (
32
- # UserName STRING(MAX),
33
- # EventDate STRING(10)
34
- # ) PRIMARY KEY(UserName, EventDate);
35
- #
36
- # The following keys name rows in this table:
37
- #
38
- # ["Bob", "2014-09-23"]
39
- # ["Alfred", "2015-06-12"]
40
- #
41
- # Since the `UserEvents` table's `PRIMARY KEY` clause names two
42
- # columns, each `UserEvents` key has two elements; the first is the
43
- # `UserName`, and the second is the `EventDate`.
44
- #
45
- # Key ranges with multiple components are interpreted
46
- # lexicographically by component using the table or index key's declared
47
- # sort order. For example, the following range returns all events for
48
- # user `"Bob"` that occurred in the year 2015:
49
- #
50
- # "start_closed": ["Bob", "2015-01-01"]
51
- # "end_closed": ["Bob", "2015-12-31"]
52
- #
53
- # Start and end keys can omit trailing key components. This affects the
54
- # inclusion and exclusion of rows that exactly match the provided key
55
- # components: if the key is closed, then rows that exactly match the
56
- # provided components are included; if the key is open, then rows
57
- # that exactly match are not included.
58
- #
59
- # For example, the following range includes all events for `"Bob"` that
60
- # occurred during and after the year 2000:
61
- #
62
- # "start_closed": ["Bob", "2000-01-01"]
63
- # "end_closed": ["Bob"]
64
- #
65
- # The next example retrieves all events for `"Bob"`:
66
- #
67
- # "start_closed": ["Bob"]
68
- # "end_closed": ["Bob"]
69
- #
70
- # To retrieve events before the year 2000:
71
- #
72
- # "start_closed": ["Bob"]
73
- # "end_open": ["Bob", "2000-01-01"]
74
- #
75
- # The following range includes all rows in the table:
76
- #
77
- # "start_closed": []
78
- # "end_closed": []
79
- #
80
- # This range returns all users whose `UserName` begins with any
81
- # character from A to C:
82
- #
83
- # "start_closed": ["A"]
84
- # "end_open": ["D"]
85
- #
86
- # This range returns all users whose `UserName` begins with B:
87
- #
88
- # "start_closed": ["B"]
89
- # "end_open": ["C"]
90
- #
91
- # Key ranges honor column sort order. For example, suppose a table is
92
- # defined as follows:
93
- #
94
- # CREATE TABLE DescendingSortedTable {
95
- # Key INT64,
96
- # ...
97
- # ) PRIMARY KEY(Key DESC);
98
- #
99
- # The following range retrieves all rows with key values between 1
100
- # and 100 inclusive:
101
- #
102
- # "start_closed": ["100"]
103
- # "end_closed": ["1"]
104
- #
105
- # Note that 100 is passed as the start, and 1 is passed as the end,
106
- # because `Key` is a descending column in the schema.
107
- # @!attribute [rw] start_closed
108
- # @return [Google::Protobuf::ListValue]
109
- # If the start is closed, then the range includes all rows whose
110
- # first `len(start_closed)` key columns exactly match `start_closed`.
111
- # @!attribute [rw] start_open
112
- # @return [Google::Protobuf::ListValue]
113
- # If the start is open, then the range excludes rows whose first
114
- # `len(start_open)` key columns exactly match `start_open`.
115
- # @!attribute [rw] end_closed
116
- # @return [Google::Protobuf::ListValue]
117
- # If the end is closed, then the range includes all rows whose
118
- # first `len(end_closed)` key columns exactly match `end_closed`.
119
- # @!attribute [rw] end_open
120
- # @return [Google::Protobuf::ListValue]
121
- # If the end is open, then the range excludes rows whose first
122
- # `len(end_open)` key columns exactly match `end_open`.
123
- class KeyRange; end
124
-
125
- # `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All
126
- # the keys are expected to be in the same table or index. The keys need
127
- # not be sorted in any particular way.
128
- #
129
- # If the same key is specified multiple times in the set (for example
130
- # if two ranges, two keys, or a key and a range overlap), Cloud Spanner
131
- # behaves as if the key were only specified once.
132
- # @!attribute [rw] keys
133
- # @return [Array<Google::Protobuf::ListValue>]
134
- # A list of specific keys. Entries in `keys` should have exactly as
135
- # many elements as there are columns in the primary or index key
136
- # with which this `KeySet` is used. Individual key values are
137
- # encoded as described {Google::Spanner::V1::TypeCode here}.
138
- # @!attribute [rw] ranges
139
- # @return [Array<Google::Spanner::V1::KeyRange>]
140
- # A list of key ranges. See {Google::Spanner::V1::KeyRange KeyRange} for more information about
141
- # key range specifications.
142
- # @!attribute [rw] all
143
- # @return [true, false]
144
- # For convenience `all` can be set to `true` to indicate that this
145
- # `KeySet` matches all keys in the table or index. Note that any keys
146
- # specified in `keys` or `ranges` are only yielded once.
147
- class KeySet; end
148
- end
149
- end
150
- end
@@ -1,95 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Spanner
18
- module V1
19
- # A modification to one or more Cloud Spanner rows. Mutations can be
20
- # applied to a Cloud Spanner database by sending them in a
21
- # {Google::Spanner::V1::Spanner::Commit Commit} call.
22
- # @!attribute [rw] insert
23
- # @return [Google::Spanner::V1::Mutation::Write]
24
- # Insert new rows in a table. If any of the rows already exist,
25
- # the write or transaction fails with error `ALREADY_EXISTS`.
26
- # @!attribute [rw] update
27
- # @return [Google::Spanner::V1::Mutation::Write]
28
- # Update existing rows in a table. If any of the rows does not
29
- # already exist, the transaction fails with error `NOT_FOUND`.
30
- # @!attribute [rw] insert_or_update
31
- # @return [Google::Spanner::V1::Mutation::Write]
32
- # Like {Google::Spanner::V1::Mutation#insert insert}, except that if the row already exists, then
33
- # its column values are overwritten with the ones provided. Any
34
- # column values not explicitly written are preserved.
35
- #
36
- # When using {Google::Spanner::V1::Mutation#insert_or_update insert_or_update}, just as when using {Google::Spanner::V1::Mutation#insert insert}, all `NOT
37
- # NULL` columns in the table must be given a value. This holds true
38
- # even when the row already exists and will therefore actually be updated.
39
- # @!attribute [rw] replace
40
- # @return [Google::Spanner::V1::Mutation::Write]
41
- # Like {Google::Spanner::V1::Mutation#insert insert}, except that if the row already exists, it is
42
- # deleted, and the column values provided are inserted
43
- # instead. Unlike {Google::Spanner::V1::Mutation#insert_or_update insert_or_update}, this means any values not
44
- # explicitly written become `NULL`.
45
- #
46
- # In an interleaved table, if you create the child table with the
47
- # `ON DELETE CASCADE` annotation, then replacing a parent row
48
- # also deletes the child rows. Otherwise, you must delete the
49
- # child rows before you replace the parent row.
50
- # @!attribute [rw] delete
51
- # @return [Google::Spanner::V1::Mutation::Delete]
52
- # Delete rows from a table. Succeeds whether or not the named
53
- # rows were present.
54
- class Mutation
55
- # Arguments to {Google::Spanner::V1::Mutation#insert insert}, {Google::Spanner::V1::Mutation#update update}, {Google::Spanner::V1::Mutation#insert_or_update insert_or_update}, and
56
- # {Google::Spanner::V1::Mutation#replace replace} operations.
57
- # @!attribute [rw] table
58
- # @return [String]
59
- # Required. The table whose rows will be written.
60
- # @!attribute [rw] columns
61
- # @return [Array<String>]
62
- # The names of the columns in {Google::Spanner::V1::Mutation::Write#table table} to be written.
63
- #
64
- # The list of columns must contain enough columns to allow
65
- # Cloud Spanner to derive values for all primary key columns in the
66
- # row(s) to be modified.
67
- # @!attribute [rw] values
68
- # @return [Array<Google::Protobuf::ListValue>]
69
- # The values to be written. `values` can contain more than one
70
- # list of values. If it does, then multiple rows are written, one
71
- # for each entry in `values`. Each list in `values` must have
72
- # exactly as many entries as there are entries in {Google::Spanner::V1::Mutation::Write#columns columns}
73
- # above. Sending multiple lists is equivalent to sending multiple
74
- # `Mutation`s, each containing one `values` entry and repeating
75
- # {Google::Spanner::V1::Mutation::Write#table table} and {Google::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
76
- # encoded as described {Google::Spanner::V1::TypeCode here}.
77
- class Write; end
78
-
79
- # Arguments to {Google::Spanner::V1::Mutation#delete delete} operations.
80
- # @!attribute [rw] table
81
- # @return [String]
82
- # Required. The table whose rows will be deleted.
83
- # @!attribute [rw] key_set
84
- # @return [Google::Spanner::V1::KeySet]
85
- # Required. The primary keys of the rows within {Google::Spanner::V1::Mutation::Delete#table table} to delete. The
86
- # primary keys must be specified in the order in which they appear in the
87
- # `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
88
- # statement used to create the table).
89
- # Delete is idempotent. The transaction will succeed even if some or all
90
- # rows do not exist.
91
- class Delete; end
92
- end
93
- end
94
- end
95
- end
@@ -1,121 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Spanner
18
- module V1
19
- # Node information for nodes appearing in a {Google::Spanner::V1::QueryPlan#plan_nodes QueryPlan#plan_nodes}.
20
- # @!attribute [rw] index
21
- # @return [Integer]
22
- # The `PlanNode`'s index in {Google::Spanner::V1::QueryPlan#plan_nodes node list}.
23
- # @!attribute [rw] kind
24
- # @return [Google::Spanner::V1::PlanNode::Kind]
25
- # Used to determine the type of node. May be needed for visualizing
26
- # different kinds of nodes differently. For example, If the node is a
27
- # {Google::Spanner::V1::PlanNode::Kind::SCALAR SCALAR} node, it will have a condensed representation
28
- # which can be used to directly embed a description of the node in its
29
- # parent.
30
- # @!attribute [rw] display_name
31
- # @return [String]
32
- # The display name for the node.
33
- # @!attribute [rw] child_links
34
- # @return [Array<Google::Spanner::V1::PlanNode::ChildLink>]
35
- # List of child node `index`es and their relationship to this parent.
36
- # @!attribute [rw] short_representation
37
- # @return [Google::Spanner::V1::PlanNode::ShortRepresentation]
38
- # Condensed representation for {Google::Spanner::V1::PlanNode::Kind::SCALAR SCALAR} nodes.
39
- # @!attribute [rw] metadata
40
- # @return [Google::Protobuf::Struct]
41
- # Attributes relevant to the node contained in a group of key-value pairs.
42
- # For example, a Parameter Reference node could have the following
43
- # information in its metadata:
44
- #
45
- # {
46
- # "parameter_reference": "param1",
47
- # "parameter_type": "array"
48
- # }
49
- # @!attribute [rw] execution_stats
50
- # @return [Google::Protobuf::Struct]
51
- # The execution statistics associated with the node, contained in a group of
52
- # key-value pairs. Only present if the plan was returned as a result of a
53
- # profile query. For example, number of executions, number of rows/time per
54
- # execution etc.
55
- class PlanNode
56
- # Metadata associated with a parent-child relationship appearing in a
57
- # {Google::Spanner::V1::PlanNode PlanNode}.
58
- # @!attribute [rw] child_index
59
- # @return [Integer]
60
- # The node to which the link points.
61
- # @!attribute [rw] type
62
- # @return [String]
63
- # The type of the link. For example, in Hash Joins this could be used to
64
- # distinguish between the build child and the probe child, or in the case
65
- # of the child being an output variable, to represent the tag associated
66
- # with the output variable.
67
- # @!attribute [rw] variable
68
- # @return [String]
69
- # Only present if the child node is {Google::Spanner::V1::PlanNode::Kind::SCALAR SCALAR} and corresponds
70
- # to an output variable of the parent node. The field carries the name of
71
- # the output variable.
72
- # For example, a `TableScan` operator that reads rows from a table will
73
- # have child links to the `SCALAR` nodes representing the output variables
74
- # created for each column that is read by the operator. The corresponding
75
- # `variable` fields will be set to the variable names assigned to the
76
- # columns.
77
- class ChildLink; end
78
-
79
- # Condensed representation of a node and its subtree. Only present for
80
- # `SCALAR` {Google::Spanner::V1::PlanNode PlanNode(s)}.
81
- # @!attribute [rw] description
82
- # @return [String]
83
- # A string representation of the expression subtree rooted at this node.
84
- # @!attribute [rw] subqueries
85
- # @return [Hash{String => Integer}]
86
- # A mapping of (subquery variable name) -> (subquery node id) for cases
87
- # where the `description` string of this node references a `SCALAR`
88
- # subquery contained in the expression subtree rooted at this node. The
89
- # referenced `SCALAR` subquery may not necessarily be a direct child of
90
- # this node.
91
- class ShortRepresentation; end
92
-
93
- # The kind of {Google::Spanner::V1::PlanNode PlanNode}. Distinguishes between the two different kinds of
94
- # nodes that can appear in a query plan.
95
- module Kind
96
- # Not specified.
97
- KIND_UNSPECIFIED = 0
98
-
99
- # Denotes a Relational operator node in the expression tree. Relational
100
- # operators represent iterative processing of rows during query execution.
101
- # For example, a `TableScan` operation that reads rows from a table.
102
- RELATIONAL = 1
103
-
104
- # Denotes a Scalar node in the expression tree. Scalar nodes represent
105
- # non-iterable entities in the query plan. For example, constants or
106
- # arithmetic operators appearing inside predicate expressions or references
107
- # to column names.
108
- SCALAR = 2
109
- end
110
- end
111
-
112
- # Contains an ordered list of nodes appearing in the query plan.
113
- # @!attribute [rw] plan_nodes
114
- # @return [Array<Google::Spanner::V1::PlanNode>]
115
- # The nodes in the query plan. Plan nodes are returned in pre-order starting
116
- # with the plan root. Each {Google::Spanner::V1::PlanNode PlanNode}'s `id` corresponds to its index in
117
- # `plan_nodes`.
118
- class QueryPlan; end
119
- end
120
- end
121
- end