Method: Google::Cloud::Spanner::Client#read
- Defined in:
- lib/google/cloud/spanner/client.rb
#read(table, columns, keys: nil, index: nil, limit: nil, single_use: nil, request_options: nil, call_options: nil, directed_read_options: nil, order_by: nil, lock_hint: nil) ⇒ Google::Cloud::Spanner::Results
Read rows from a database table, as a simple alternative to #execute_query.
The following settings can be provided:
:exclude_replicas(Hash) Exclude_replicas indicates what replicas should be excluded from serving requests. Spanner will not route requests to the replicas in this list.:include_replicas(Hash) Include_replicas indicates the order of replicas to process the request. If auto_failover_disabled is set to true and all replicas are exhausted without finding a healthy replica, Spanner will wait for a replica in the list to become available, requests may fail due to DEADLINE_EXCEEDED errors.
985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/google/cloud/spanner/client.rb', line 985 def read table, columns, keys: nil, index: nil, limit: nil, single_use: nil, request_options: nil, call_options: nil, directed_read_options: nil, order_by: nil, lock_hint: nil validate_single_use_args! single_use ensure_service! columns = Array(columns).map(&:to_s) keys = Convert.to_key_set keys single_use_tx = single_use_transaction single_use route_to_leader = LARHeaders.read false = Convert. , tag_type: :request_tag results = nil @pool.with_session do |session| results = session.read \ table, columns, keys: keys, index: index, limit: limit, transaction: single_use_tx, request_options: , call_options: , directed_read_options: || @directed_read_options, route_to_leader: route_to_leader, order_by: order_by, lock_hint: lock_hint end results end |