google-cloud-spanner 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LOGGING.md +1 -1
- data/OVERVIEW.md +1 -1
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +29 -29
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +13 -13
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +28 -28
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +9 -9
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +8 -8
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +11 -11
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +21 -21
- data/lib/google/cloud/spanner/admin/database/v1.rb +4 -4
- data/lib/google/cloud/spanner/admin/database.rb +4 -4
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +13 -13
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +28 -28
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +9 -9
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +8 -8
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +7 -7
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +11 -11
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +30 -30
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +44 -44
- data/lib/google/cloud/spanner/admin/instance/v1.rb +4 -4
- data/lib/google/cloud/spanner/admin/instance.rb +4 -4
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +3 -3
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +11 -11
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +7 -7
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +19 -19
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +6 -6
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +11 -11
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +33 -19
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +65 -39
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +91 -21
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +25 -25
- data/lib/google/cloud/spanner/v1/spanner_client.rb +139 -79
- data/lib/google/cloud/spanner/version.rb +1 -1
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +1 -1
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +1 -1
- data/lib/google/spanner/v1/result_set_pb.rb +4 -0
- data/lib/google/spanner/v1/spanner_pb.rb +1 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +14 -6
- data/lib/google/spanner/v1/transaction_pb.rb +4 -0
- data/lib/google-cloud-spanner.rb +1 -1
- metadata +3 -3
@@ -298,10 +298,10 @@ module Google
|
|
298
298
|
# time; thus, it is a good idea to delete idle and/or unneeded sessions.
|
299
299
|
# Aside from explicit deletes, Cloud Spanner can delete sessions for which no
|
300
300
|
# operations are sent for more than an hour. If a session is deleted,
|
301
|
-
# requests to it return
|
301
|
+
# requests to it return `NOT_FOUND`.
|
302
302
|
#
|
303
303
|
# Idle sessions can be kept alive by sending a trivial SQL query
|
304
|
-
# periodically, e.g.,
|
304
|
+
# periodically, e.g., `"SELECT 1"`.
|
305
305
|
#
|
306
306
|
# @param database [String]
|
307
307
|
# Required. The database in which the new session is created.
|
@@ -337,7 +337,7 @@ module Google
|
|
337
337
|
@create_session.call(req, options, &block)
|
338
338
|
end
|
339
339
|
|
340
|
-
# Gets a session. Returns
|
340
|
+
# Gets a session. Returns `NOT_FOUND` if the session does not exist.
|
341
341
|
# This is mainly useful for determining whether a session is still
|
342
342
|
# alive.
|
343
343
|
#
|
@@ -383,12 +383,12 @@ module Google
|
|
383
383
|
# An expression for filtering the results of the request. Filter rules are
|
384
384
|
# case insensitive. The fields eligible for filtering are:
|
385
385
|
#
|
386
|
-
# *
|
386
|
+
# * `labels.key` where key is the name of a label
|
387
387
|
#
|
388
388
|
# Some examples of using filters are:
|
389
389
|
#
|
390
|
-
# *
|
391
|
-
# *
|
390
|
+
# * `labels.env:*` --> The session has the label "env".
|
391
|
+
# * `labels.env:dev` --> The session has the label "env" and the value of
|
392
392
|
# the label contains the string "dev".
|
393
393
|
# @param options [Google::Gax::CallOptions]
|
394
394
|
# Overrides the default settings for this call, e.g, timeout,
|
@@ -466,12 +466,12 @@ module Google
|
|
466
466
|
nil
|
467
467
|
end
|
468
468
|
|
469
|
-
# Executes an SQL
|
469
|
+
# Executes an SQL statement, returning all results in a single reply. This
|
470
470
|
# method cannot be used to return a result set larger than 10 MiB;
|
471
471
|
# if the query yields more data than that, the query fails with
|
472
|
-
# a
|
472
|
+
# a `FAILED_PRECONDITION` error.
|
473
473
|
#
|
474
|
-
#
|
474
|
+
# Operations inside read-write transactions might return `ABORTED`. If
|
475
475
|
# this occurs, the application should restart the transaction from
|
476
476
|
# the beginning. See {Google::Spanner::V1::Transaction Transaction} for more details.
|
477
477
|
#
|
@@ -481,45 +481,56 @@ module Google
|
|
481
481
|
# @param session [String]
|
482
482
|
# Required. The session in which the SQL query should be performed.
|
483
483
|
# @param sql [String]
|
484
|
-
# Required. The SQL
|
484
|
+
# Required. The SQL string.
|
485
485
|
# @param transaction [Google::Spanner::V1::TransactionSelector | Hash]
|
486
486
|
# The transaction to use. If none is provided, the default is a
|
487
487
|
# temporary read-only transaction with strong concurrency.
|
488
|
+
#
|
489
|
+
# The transaction to use.
|
490
|
+
#
|
491
|
+
# For queries, if none is provided, the default is a temporary read-only
|
492
|
+
# transaction with strong concurrency.
|
493
|
+
#
|
494
|
+
# Standard DML statements require a ReadWrite transaction. Single-use
|
495
|
+
# transactions are not supported (to avoid replay). The caller must
|
496
|
+
# either supply an existing transaction ID or begin a new transaction.
|
497
|
+
#
|
498
|
+
# Partitioned DML requires an existing PartitionedDml transaction ID.
|
488
499
|
# A hash of the same form as `Google::Spanner::V1::TransactionSelector`
|
489
500
|
# can also be provided.
|
490
501
|
# @param params [Google::Protobuf::Struct | Hash]
|
491
|
-
# The SQL
|
492
|
-
# placeholder consists of
|
502
|
+
# The SQL string can contain parameter placeholders. A parameter
|
503
|
+
# placeholder consists of `'@'` followed by the parameter
|
493
504
|
# name. Parameter names consist of any combination of letters,
|
494
505
|
# numbers, and underscores.
|
495
506
|
#
|
496
507
|
# Parameters can appear anywhere that a literal value is expected. The same
|
497
508
|
# parameter name can be used more than once, for example:
|
498
|
-
#
|
509
|
+
# `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
499
510
|
#
|
500
|
-
# It is an error to execute an SQL
|
511
|
+
# It is an error to execute an SQL statement with unbound parameters.
|
501
512
|
#
|
502
|
-
# Parameter values are specified using
|
513
|
+
# Parameter values are specified using `params`, which is a JSON
|
503
514
|
# object whose keys are parameter names, and whose values are the
|
504
515
|
# corresponding parameter values.
|
505
516
|
# A hash of the same form as `Google::Protobuf::Struct`
|
506
517
|
# can also be provided.
|
507
518
|
# @param param_types [Hash{String => Google::Spanner::V1::Type | Hash}]
|
508
519
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
509
|
-
# from a JSON value. For example, values of type
|
510
|
-
# of type
|
520
|
+
# from a JSON value. For example, values of type `BYTES` and values
|
521
|
+
# of type `STRING` both appear in {Google::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
|
511
522
|
#
|
512
|
-
# In these cases,
|
513
|
-
# SQL type for some or all of the SQL
|
523
|
+
# In these cases, `param_types` can be used to specify the exact
|
524
|
+
# SQL type for some or all of the SQL statement parameters. See the
|
514
525
|
# definition of {Google::Spanner::V1::Type Type} for more information
|
515
526
|
# about SQL types.
|
516
527
|
# A hash of the same form as `Google::Spanner::V1::Type`
|
517
528
|
# can also be provided.
|
518
529
|
# @param resume_token [String]
|
519
|
-
# If this request is resuming a previously interrupted SQL
|
520
|
-
# execution,
|
530
|
+
# If this request is resuming a previously interrupted SQL statement
|
531
|
+
# execution, `resume_token` should be copied from the last
|
521
532
|
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
522
|
-
# enables the new SQL
|
533
|
+
# enables the new SQL statement execution to resume where the last one left
|
523
534
|
# off. The rest of the request parameters must exactly match the
|
524
535
|
# request that yielded this token.
|
525
536
|
# @param query_mode [Google::Spanner::V1::ExecuteSqlRequest::QueryMode]
|
@@ -531,6 +542,17 @@ module Google
|
|
531
542
|
# previously created using PartitionQuery(). There must be an exact
|
532
543
|
# match for the values of fields common to this message and the
|
533
544
|
# PartitionQueryRequest message used to create this partition_token.
|
545
|
+
# @param seqno [Integer]
|
546
|
+
# A per-transaction sequence number used to identify this request. This
|
547
|
+
# makes each request idempotent such that if the request is received multiple
|
548
|
+
# times, at most one will succeed.
|
549
|
+
#
|
550
|
+
# The sequence number must be monotonically increasing within the
|
551
|
+
# transaction. If a request arrives for the first time with an out-of-order
|
552
|
+
# sequence number, the transaction may be aborted. Replays of previously
|
553
|
+
# handled requests will yield the same response as the first execution.
|
554
|
+
#
|
555
|
+
# Required for DML statements. Ignored for queries.
|
534
556
|
# @param options [Google::Gax::CallOptions]
|
535
557
|
# Overrides the default settings for this call, e.g, timeout,
|
536
558
|
# retries, etc.
|
@@ -545,7 +567,7 @@ module Google
|
|
545
567
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
546
568
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
547
569
|
#
|
548
|
-
# # TODO: Initialize
|
570
|
+
# # TODO: Initialize `sql`:
|
549
571
|
# sql = ''
|
550
572
|
# response = spanner_client.execute_sql(formatted_session, sql)
|
551
573
|
|
@@ -558,6 +580,7 @@ module Google
|
|
558
580
|
resume_token: nil,
|
559
581
|
query_mode: nil,
|
560
582
|
partition_token: nil,
|
583
|
+
seqno: nil,
|
561
584
|
options: nil,
|
562
585
|
&block
|
563
586
|
req = {
|
@@ -568,7 +591,8 @@ module Google
|
|
568
591
|
param_types: param_types,
|
569
592
|
resume_token: resume_token,
|
570
593
|
query_mode: query_mode,
|
571
|
-
partition_token: partition_token
|
594
|
+
partition_token: partition_token,
|
595
|
+
seqno: seqno
|
572
596
|
}.delete_if { |_, v| v.nil? }
|
573
597
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::ExecuteSqlRequest)
|
574
598
|
@execute_sql.call(req, options, &block)
|
@@ -583,45 +607,56 @@ module Google
|
|
583
607
|
# @param session [String]
|
584
608
|
# Required. The session in which the SQL query should be performed.
|
585
609
|
# @param sql [String]
|
586
|
-
# Required. The SQL
|
610
|
+
# Required. The SQL string.
|
587
611
|
# @param transaction [Google::Spanner::V1::TransactionSelector | Hash]
|
588
612
|
# The transaction to use. If none is provided, the default is a
|
589
613
|
# temporary read-only transaction with strong concurrency.
|
614
|
+
#
|
615
|
+
# The transaction to use.
|
616
|
+
#
|
617
|
+
# For queries, if none is provided, the default is a temporary read-only
|
618
|
+
# transaction with strong concurrency.
|
619
|
+
#
|
620
|
+
# Standard DML statements require a ReadWrite transaction. Single-use
|
621
|
+
# transactions are not supported (to avoid replay). The caller must
|
622
|
+
# either supply an existing transaction ID or begin a new transaction.
|
623
|
+
#
|
624
|
+
# Partitioned DML requires an existing PartitionedDml transaction ID.
|
590
625
|
# A hash of the same form as `Google::Spanner::V1::TransactionSelector`
|
591
626
|
# can also be provided.
|
592
627
|
# @param params [Google::Protobuf::Struct | Hash]
|
593
|
-
# The SQL
|
594
|
-
# placeholder consists of
|
628
|
+
# The SQL string can contain parameter placeholders. A parameter
|
629
|
+
# placeholder consists of `'@'` followed by the parameter
|
595
630
|
# name. Parameter names consist of any combination of letters,
|
596
631
|
# numbers, and underscores.
|
597
632
|
#
|
598
633
|
# Parameters can appear anywhere that a literal value is expected. The same
|
599
634
|
# parameter name can be used more than once, for example:
|
600
|
-
#
|
635
|
+
# `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
601
636
|
#
|
602
|
-
# It is an error to execute an SQL
|
637
|
+
# It is an error to execute an SQL statement with unbound parameters.
|
603
638
|
#
|
604
|
-
# Parameter values are specified using
|
639
|
+
# Parameter values are specified using `params`, which is a JSON
|
605
640
|
# object whose keys are parameter names, and whose values are the
|
606
641
|
# corresponding parameter values.
|
607
642
|
# A hash of the same form as `Google::Protobuf::Struct`
|
608
643
|
# can also be provided.
|
609
644
|
# @param param_types [Hash{String => Google::Spanner::V1::Type | Hash}]
|
610
645
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
611
|
-
# from a JSON value. For example, values of type
|
612
|
-
# of type
|
646
|
+
# from a JSON value. For example, values of type `BYTES` and values
|
647
|
+
# of type `STRING` both appear in {Google::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
|
613
648
|
#
|
614
|
-
# In these cases,
|
615
|
-
# SQL type for some or all of the SQL
|
649
|
+
# In these cases, `param_types` can be used to specify the exact
|
650
|
+
# SQL type for some or all of the SQL statement parameters. See the
|
616
651
|
# definition of {Google::Spanner::V1::Type Type} for more information
|
617
652
|
# about SQL types.
|
618
653
|
# A hash of the same form as `Google::Spanner::V1::Type`
|
619
654
|
# can also be provided.
|
620
655
|
# @param resume_token [String]
|
621
|
-
# If this request is resuming a previously interrupted SQL
|
622
|
-
# execution,
|
656
|
+
# If this request is resuming a previously interrupted SQL statement
|
657
|
+
# execution, `resume_token` should be copied from the last
|
623
658
|
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
624
|
-
# enables the new SQL
|
659
|
+
# enables the new SQL statement execution to resume where the last one left
|
625
660
|
# off. The rest of the request parameters must exactly match the
|
626
661
|
# request that yielded this token.
|
627
662
|
# @param query_mode [Google::Spanner::V1::ExecuteSqlRequest::QueryMode]
|
@@ -633,6 +668,17 @@ module Google
|
|
633
668
|
# previously created using PartitionQuery(). There must be an exact
|
634
669
|
# match for the values of fields common to this message and the
|
635
670
|
# PartitionQueryRequest message used to create this partition_token.
|
671
|
+
# @param seqno [Integer]
|
672
|
+
# A per-transaction sequence number used to identify this request. This
|
673
|
+
# makes each request idempotent such that if the request is received multiple
|
674
|
+
# times, at most one will succeed.
|
675
|
+
#
|
676
|
+
# The sequence number must be monotonically increasing within the
|
677
|
+
# transaction. If a request arrives for the first time with an out-of-order
|
678
|
+
# sequence number, the transaction may be aborted. Replays of previously
|
679
|
+
# handled requests will yield the same response as the first execution.
|
680
|
+
#
|
681
|
+
# Required for DML statements. Ignored for queries.
|
636
682
|
# @param options [Google::Gax::CallOptions]
|
637
683
|
# Overrides the default settings for this call, e.g, timeout,
|
638
684
|
# retries, etc.
|
@@ -646,7 +692,7 @@ module Google
|
|
646
692
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
647
693
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
648
694
|
#
|
649
|
-
# # TODO: Initialize
|
695
|
+
# # TODO: Initialize `sql`:
|
650
696
|
# sql = ''
|
651
697
|
# spanner_client.execute_streaming_sql(formatted_session, sql).each do |element|
|
652
698
|
# # Process element.
|
@@ -661,6 +707,7 @@ module Google
|
|
661
707
|
resume_token: nil,
|
662
708
|
query_mode: nil,
|
663
709
|
partition_token: nil,
|
710
|
+
seqno: nil,
|
664
711
|
options: nil
|
665
712
|
req = {
|
666
713
|
session: session,
|
@@ -670,7 +717,8 @@ module Google
|
|
670
717
|
param_types: param_types,
|
671
718
|
resume_token: resume_token,
|
672
719
|
query_mode: query_mode,
|
673
|
-
partition_token: partition_token
|
720
|
+
partition_token: partition_token,
|
721
|
+
seqno: seqno
|
674
722
|
}.delete_if { |_, v| v.nil? }
|
675
723
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::ExecuteSqlRequest)
|
676
724
|
@execute_streaming_sql.call(req, options)
|
@@ -680,10 +728,10 @@ module Google
|
|
680
728
|
# simple key/value style alternative to
|
681
729
|
# {Google::Spanner::V1::Spanner::ExecuteSql ExecuteSql}. This method cannot be used to
|
682
730
|
# return a result set larger than 10 MiB; if the read matches more
|
683
|
-
# data than that, the read fails with a
|
731
|
+
# data than that, the read fails with a `FAILED_PRECONDITION`
|
684
732
|
# error.
|
685
733
|
#
|
686
|
-
# Reads inside read-write transactions might return
|
734
|
+
# Reads inside read-write transactions might return `ABORTED`. If
|
687
735
|
# this occurs, the application should restart the transaction from
|
688
736
|
# the beginning. See {Google::Spanner::V1::Transaction Transaction} for more details.
|
689
737
|
#
|
@@ -698,7 +746,7 @@ module Google
|
|
698
746
|
# The columns of {Google::Spanner::V1::ReadRequest#table table} to be returned for each row matching
|
699
747
|
# this request.
|
700
748
|
# @param key_set [Google::Spanner::V1::KeySet | Hash]
|
701
|
-
# Required.
|
749
|
+
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
702
750
|
# primary keys of the rows in {Google::Spanner::V1::ReadRequest#table table} to be yielded, unless {Google::Spanner::V1::ReadRequest#index index}
|
703
751
|
# is present. If {Google::Spanner::V1::ReadRequest#index index} is present, then {Google::Spanner::V1::ReadRequest#key_set key_set} instead names
|
704
752
|
# index keys in {Google::Spanner::V1::ReadRequest#index index}.
|
@@ -708,7 +756,7 @@ module Google
|
|
708
756
|
# (if {Google::Spanner::V1::ReadRequest#index index} is non-empty). If the {Google::Spanner::V1::ReadRequest#partition_token partition_token} field is not
|
709
757
|
# empty, rows will be yielded in an unspecified order.
|
710
758
|
#
|
711
|
-
# It is not an error for the
|
759
|
+
# It is not an error for the `key_set` to name rows that do not
|
712
760
|
# exist in the database. Read yields nothing for nonexistent rows.
|
713
761
|
# A hash of the same form as `Google::Spanner::V1::KeySet`
|
714
762
|
# can also be provided.
|
@@ -722,12 +770,12 @@ module Google
|
|
722
770
|
# used instead of the table primary key when interpreting {Google::Spanner::V1::ReadRequest#key_set key_set}
|
723
771
|
# and sorting result rows. See {Google::Spanner::V1::ReadRequest#key_set key_set} for further information.
|
724
772
|
# @param limit [Integer]
|
725
|
-
# If greater than zero, only the first
|
773
|
+
# If greater than zero, only the first `limit` rows are yielded. If `limit`
|
726
774
|
# is zero, the default is no limit. A limit cannot be specified if
|
727
|
-
#
|
775
|
+
# `partition_token` is set.
|
728
776
|
# @param resume_token [String]
|
729
777
|
# If this request is resuming a previously interrupted read,
|
730
|
-
#
|
778
|
+
# `resume_token` should be copied from the last
|
731
779
|
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
732
780
|
# enables the new read to resume where the last read left off. The
|
733
781
|
# rest of the request parameters must exactly match the request
|
@@ -751,13 +799,13 @@ module Google
|
|
751
799
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
752
800
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
753
801
|
#
|
754
|
-
# # TODO: Initialize
|
802
|
+
# # TODO: Initialize `table`:
|
755
803
|
# table = ''
|
756
804
|
#
|
757
|
-
# # TODO: Initialize
|
805
|
+
# # TODO: Initialize `columns`:
|
758
806
|
# columns = []
|
759
807
|
#
|
760
|
-
# # TODO: Initialize
|
808
|
+
# # TODO: Initialize `key_set`:
|
761
809
|
# key_set = {}
|
762
810
|
# response = spanner_client.read(formatted_session, table, columns, key_set)
|
763
811
|
|
@@ -802,7 +850,7 @@ module Google
|
|
802
850
|
# The columns of {Google::Spanner::V1::ReadRequest#table table} to be returned for each row matching
|
803
851
|
# this request.
|
804
852
|
# @param key_set [Google::Spanner::V1::KeySet | Hash]
|
805
|
-
# Required.
|
853
|
+
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
806
854
|
# primary keys of the rows in {Google::Spanner::V1::ReadRequest#table table} to be yielded, unless {Google::Spanner::V1::ReadRequest#index index}
|
807
855
|
# is present. If {Google::Spanner::V1::ReadRequest#index index} is present, then {Google::Spanner::V1::ReadRequest#key_set key_set} instead names
|
808
856
|
# index keys in {Google::Spanner::V1::ReadRequest#index index}.
|
@@ -812,7 +860,7 @@ module Google
|
|
812
860
|
# (if {Google::Spanner::V1::ReadRequest#index index} is non-empty). If the {Google::Spanner::V1::ReadRequest#partition_token partition_token} field is not
|
813
861
|
# empty, rows will be yielded in an unspecified order.
|
814
862
|
#
|
815
|
-
# It is not an error for the
|
863
|
+
# It is not an error for the `key_set` to name rows that do not
|
816
864
|
# exist in the database. Read yields nothing for nonexistent rows.
|
817
865
|
# A hash of the same form as `Google::Spanner::V1::KeySet`
|
818
866
|
# can also be provided.
|
@@ -826,12 +874,12 @@ module Google
|
|
826
874
|
# used instead of the table primary key when interpreting {Google::Spanner::V1::ReadRequest#key_set key_set}
|
827
875
|
# and sorting result rows. See {Google::Spanner::V1::ReadRequest#key_set key_set} for further information.
|
828
876
|
# @param limit [Integer]
|
829
|
-
# If greater than zero, only the first
|
877
|
+
# If greater than zero, only the first `limit` rows are yielded. If `limit`
|
830
878
|
# is zero, the default is no limit. A limit cannot be specified if
|
831
|
-
#
|
879
|
+
# `partition_token` is set.
|
832
880
|
# @param resume_token [String]
|
833
881
|
# If this request is resuming a previously interrupted read,
|
834
|
-
#
|
882
|
+
# `resume_token` should be copied from the last
|
835
883
|
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
836
884
|
# enables the new read to resume where the last read left off. The
|
837
885
|
# rest of the request parameters must exactly match the request
|
@@ -854,13 +902,13 @@ module Google
|
|
854
902
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
855
903
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
856
904
|
#
|
857
|
-
# # TODO: Initialize
|
905
|
+
# # TODO: Initialize `table`:
|
858
906
|
# table = ''
|
859
907
|
#
|
860
|
-
# # TODO: Initialize
|
908
|
+
# # TODO: Initialize `columns`:
|
861
909
|
# columns = []
|
862
910
|
#
|
863
|
-
# # TODO: Initialize
|
911
|
+
# # TODO: Initialize `key_set`:
|
864
912
|
# key_set = {}
|
865
913
|
# spanner_client.streaming_read(formatted_session, table, columns, key_set).each do |element|
|
866
914
|
# # Process element.
|
@@ -917,7 +965,7 @@ module Google
|
|
917
965
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
918
966
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
919
967
|
#
|
920
|
-
# # TODO: Initialize
|
968
|
+
# # TODO: Initialize `options_`:
|
921
969
|
# options_ = {}
|
922
970
|
# response = spanner_client.begin_transaction(formatted_session, options_)
|
923
971
|
|
@@ -937,10 +985,10 @@ module Google
|
|
937
985
|
# Commits a transaction. The request includes the mutations to be
|
938
986
|
# applied to rows in the database.
|
939
987
|
#
|
940
|
-
#
|
988
|
+
# `Commit` might return an `ABORTED` error. This can occur at any time;
|
941
989
|
# commonly, the cause is conflicts with concurrent
|
942
990
|
# transactions. However, it can also happen for a variety of other
|
943
|
-
# reasons. If
|
991
|
+
# reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
|
944
992
|
# the transaction from the beginning, re-using the same session.
|
945
993
|
#
|
946
994
|
# @param session [String]
|
@@ -957,7 +1005,7 @@ module Google
|
|
957
1005
|
# Execute mutations in a temporary transaction. Note that unlike
|
958
1006
|
# commit of a previously-started transaction, commit with a
|
959
1007
|
# temporary transaction is non-idempotent. That is, if the
|
960
|
-
#
|
1008
|
+
# `CommitRequest` is sent to Cloud Spanner more than once (for
|
961
1009
|
# instance, due to retries in the application, or in the
|
962
1010
|
# transport library), it is possible that the mutations are
|
963
1011
|
# executed more than once. If this is undesirable, use
|
@@ -979,7 +1027,7 @@ module Google
|
|
979
1027
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
980
1028
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
981
1029
|
#
|
982
|
-
# # TODO: Initialize
|
1030
|
+
# # TODO: Initialize `mutations`:
|
983
1031
|
# mutations = []
|
984
1032
|
# response = spanner_client.commit(formatted_session, mutations)
|
985
1033
|
|
@@ -1005,9 +1053,9 @@ module Google
|
|
1005
1053
|
# {Google::Spanner::V1::Spanner::Read Read} or {Google::Spanner::V1::Spanner::ExecuteSql ExecuteSql} requests and
|
1006
1054
|
# ultimately decides not to commit.
|
1007
1055
|
#
|
1008
|
-
#
|
1056
|
+
# `Rollback` returns `OK` if it successfully aborts the transaction, the
|
1009
1057
|
# transaction was already aborted, or the transaction is not
|
1010
|
-
# found.
|
1058
|
+
# found. `Rollback` never returns `ABORTED`.
|
1011
1059
|
#
|
1012
1060
|
# @param session [String]
|
1013
1061
|
# Required. The session in which the transaction to roll back is running.
|
@@ -1026,7 +1074,7 @@ module Google
|
|
1026
1074
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
1027
1075
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
1028
1076
|
#
|
1029
|
-
# # TODO: Initialize
|
1077
|
+
# # TODO: Initialize `transaction_id`:
|
1030
1078
|
# transaction_id = ''
|
1031
1079
|
# spanner_client.rollback(formatted_session, transaction_id)
|
1032
1080
|
|
@@ -1050,8 +1098,11 @@ module Google
|
|
1050
1098
|
# of the query result to read. The same session and read-only transaction
|
1051
1099
|
# must be used by the PartitionQueryRequest used to create the
|
1052
1100
|
# partition tokens and the ExecuteSqlRequests that use the partition tokens.
|
1101
|
+
#
|
1053
1102
|
# Partition tokens become invalid when the session used to create them
|
1054
|
-
# is deleted
|
1103
|
+
# is deleted, is idle for too long, begins a new transaction, or becomes too
|
1104
|
+
# old. When any of these happen, it is not possible to resume the query, and
|
1105
|
+
# the whole operation must be restarted from the beginning.
|
1055
1106
|
#
|
1056
1107
|
# @param session [String]
|
1057
1108
|
# Required. The session used to create the partitions.
|
@@ -1062,6 +1113,10 @@ module Google
|
|
1062
1113
|
# union operator conceptually divides one or more tables into multiple
|
1063
1114
|
# splits, remotely evaluates a subquery independently on each split, and
|
1064
1115
|
# then unions all results.
|
1116
|
+
#
|
1117
|
+
# This must not contain DML commands, such as INSERT, UPDATE, or
|
1118
|
+
# DELETE. Use {Google::Spanner::V1::Spanner::ExecuteStreamingSql ExecuteStreamingSql} with a
|
1119
|
+
# PartitionedDml transaction for large, partition-friendly DML operations.
|
1065
1120
|
# @param transaction [Google::Spanner::V1::TransactionSelector | Hash]
|
1066
1121
|
# Read only snapshot transactions are supported, read/write and single use
|
1067
1122
|
# transactions are not.
|
@@ -1069,27 +1124,27 @@ module Google
|
|
1069
1124
|
# can also be provided.
|
1070
1125
|
# @param params [Google::Protobuf::Struct | Hash]
|
1071
1126
|
# The SQL query string can contain parameter placeholders. A parameter
|
1072
|
-
# placeholder consists of
|
1127
|
+
# placeholder consists of `'@'` followed by the parameter
|
1073
1128
|
# name. Parameter names consist of any combination of letters,
|
1074
1129
|
# numbers, and underscores.
|
1075
1130
|
#
|
1076
1131
|
# Parameters can appear anywhere that a literal value is expected. The same
|
1077
1132
|
# parameter name can be used more than once, for example:
|
1078
|
-
#
|
1133
|
+
# `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
1079
1134
|
#
|
1080
1135
|
# It is an error to execute an SQL query with unbound parameters.
|
1081
1136
|
#
|
1082
|
-
# Parameter values are specified using
|
1137
|
+
# Parameter values are specified using `params`, which is a JSON
|
1083
1138
|
# object whose keys are parameter names, and whose values are the
|
1084
1139
|
# corresponding parameter values.
|
1085
1140
|
# A hash of the same form as `Google::Protobuf::Struct`
|
1086
1141
|
# can also be provided.
|
1087
1142
|
# @param param_types [Hash{String => Google::Spanner::V1::Type | Hash}]
|
1088
1143
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
1089
|
-
# from a JSON value. For example, values of type
|
1090
|
-
# of type
|
1144
|
+
# from a JSON value. For example, values of type `BYTES` and values
|
1145
|
+
# of type `STRING` both appear in {Google::Spanner::V1::PartitionQueryRequest#params params} as JSON strings.
|
1091
1146
|
#
|
1092
|
-
# In these cases,
|
1147
|
+
# In these cases, `param_types` can be used to specify the exact
|
1093
1148
|
# SQL type for some or all of the SQL query parameters. See the
|
1094
1149
|
# definition of {Google::Spanner::V1::Type Type} for more information
|
1095
1150
|
# about SQL types.
|
@@ -1113,7 +1168,7 @@ module Google
|
|
1113
1168
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
1114
1169
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
1115
1170
|
#
|
1116
|
-
# # TODO: Initialize
|
1171
|
+
# # TODO: Initialize `sql`:
|
1117
1172
|
# sql = ''
|
1118
1173
|
# response = spanner_client.partition_query(formatted_session, sql)
|
1119
1174
|
|
@@ -1143,21 +1198,26 @@ module Google
|
|
1143
1198
|
# by {Google::Spanner::V1::Spanner::StreamingRead StreamingRead} to specify a subset of the read
|
1144
1199
|
# result to read. The same session and read-only transaction must be used by
|
1145
1200
|
# the PartitionReadRequest used to create the partition tokens and the
|
1146
|
-
# ReadRequests that use the partition tokens.
|
1201
|
+
# ReadRequests that use the partition tokens. There are no ordering
|
1202
|
+
# guarantees on rows returned among the returned partition tokens, or even
|
1203
|
+
# within each individual StreamingRead call issued with a partition_token.
|
1204
|
+
#
|
1147
1205
|
# Partition tokens become invalid when the session used to create them
|
1148
|
-
# is deleted
|
1206
|
+
# is deleted, is idle for too long, begins a new transaction, or becomes too
|
1207
|
+
# old. When any of these happen, it is not possible to resume the read, and
|
1208
|
+
# the whole operation must be restarted from the beginning.
|
1149
1209
|
#
|
1150
1210
|
# @param session [String]
|
1151
1211
|
# Required. The session used to create the partitions.
|
1152
1212
|
# @param table [String]
|
1153
1213
|
# Required. The name of the table in the database to be read.
|
1154
1214
|
# @param key_set [Google::Spanner::V1::KeySet | Hash]
|
1155
|
-
# Required.
|
1215
|
+
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
1156
1216
|
# primary keys of the rows in {Google::Spanner::V1::PartitionReadRequest#table table} to be yielded, unless {Google::Spanner::V1::PartitionReadRequest#index index}
|
1157
1217
|
# is present. If {Google::Spanner::V1::PartitionReadRequest#index index} is present, then {Google::Spanner::V1::PartitionReadRequest#key_set key_set} instead names
|
1158
1218
|
# index keys in {Google::Spanner::V1::PartitionReadRequest#index index}.
|
1159
1219
|
#
|
1160
|
-
# It is not an error for the
|
1220
|
+
# It is not an error for the `key_set` to name rows that do not
|
1161
1221
|
# exist in the database. Read yields nothing for nonexistent rows.
|
1162
1222
|
# A hash of the same form as `Google::Spanner::V1::KeySet`
|
1163
1223
|
# can also be provided.
|
@@ -1191,10 +1251,10 @@ module Google
|
|
1191
1251
|
# spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
|
1192
1252
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
1193
1253
|
#
|
1194
|
-
# # TODO: Initialize
|
1254
|
+
# # TODO: Initialize `table`:
|
1195
1255
|
# table = ''
|
1196
1256
|
#
|
1197
|
-
# # TODO: Initialize
|
1257
|
+
# # TODO: Initialize `key_set`:
|
1198
1258
|
# key_set = {}
|
1199
1259
|
# response = spanner_client.partition_read(formatted_session, table, key_set)
|
1200
1260
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/spanner/admin/database/v1/spanner_database_admin.proto for package 'google.spanner.admin.database.v1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright 2018 Google
|
4
|
+
# Copyright 2018 Google LLC
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/spanner/admin/instance/v1/spanner_instance_admin.proto for package 'google.spanner.admin.instance.v1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright 2018 Google
|
4
|
+
# Copyright 2018 Google LLC
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -29,6 +29,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
29
29
|
add_message "google.spanner.v1.ResultSetStats" do
|
30
30
|
optional :query_plan, :message, 1, "google.spanner.v1.QueryPlan"
|
31
31
|
optional :query_stats, :message, 2, "google.protobuf.Struct"
|
32
|
+
oneof :row_count do
|
33
|
+
optional :row_count_exact, :int64, 3
|
34
|
+
optional :row_count_lower_bound, :int64, 4
|
35
|
+
end
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
@@ -49,6 +49,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
49
49
|
optional :resume_token, :bytes, 6
|
50
50
|
optional :query_mode, :enum, 7, "google.spanner.v1.ExecuteSqlRequest.QueryMode"
|
51
51
|
optional :partition_token, :bytes, 8
|
52
|
+
optional :seqno, :int64, 9
|
52
53
|
end
|
53
54
|
add_enum "google.spanner.v1.ExecuteSqlRequest.QueryMode" do
|
54
55
|
value :NORMAL, 0
|