ResultSetMetadata

Metadata about a ResultSet or PartialResultSet.

JSON representation
{
  "rowType": {
    object(StructType)
  },
  "transaction": {
    object(Transaction)
  },
}
Fields
rowType

object(StructType)

Indicates the field names and types for the rows in the result set. For example, a SQL query like "SELECT UserId, UserName FROM Users" could return a rowType value like:

"fields": [
  { "name": "UserId", "type": { "code": "INT64" } },
  { "name": "UserName", "type": { "code": "STRING" } },
]

transaction

object(Transaction)

If the read or SQL query began a transaction as a side-effect, the information about the new transaction is yielded here.

StructType

StructType defines the fields of a STRUCT type.

JSON representation
{
  "fields": [
    {
      object(Field)
    }
  ],
}
Fields
fields[]

object(Field)

The list of fields that make up this struct. Order is significant, because values of this struct type are represented as lists, where the order of field values matches the order of fields in the StructType. In turn, the order of fields matches the order of columns in a read request, or the order of fields in the SELECT clause of a query.

Field

Message representing a single field of a struct.

JSON representation
{
  "name": string,
  "type": {
    object(Type)
  },
}
Fields
name

string

The name of the field. For reads, this is the column name. For SQL queries, it is the column alias (e.g., "Word" in the query "SELECT 'hello' AS Word"), or the column name (e.g., "ColName" in the query "SELECT ColName FROM Table"). Some columns might have an empty name (e.g., !"SELECT UPPER(ColName)"`). Note that a query result can contain multiple fields with the same name.

type

object(Type)

The type of the field.

Type

Type indicates the type of a Cloud Spanner value, as might be stored in a table cell or returned from an SQL query.

JSON representation
{
  "code": enum(TypeCode),
  "arrayElementType": {
    object(Type)
  },
  "structType": {
    object(StructType)
  },
}
Fields
code

enum(TypeCode)

Required. The TypeCode for this type.

arrayElementType

object(Type)

If code == ARRAY, then arrayElementType is the type of the array elements.

structType

object(StructType)

If code == STRUCT, then structType provides type information for the struct's fields.

TypeCode

TypeCode is used as part of Type to indicate the type of a Cloud Spanner value.

Each legal value of a type can be encoded to or decoded from a JSON value, using the encodings described below. All Cloud Spanner values can be null, regardless of type; nulls are always encoded as a JSON null.

Enums
TYPE_CODE_UNSPECIFIED Not specified.
BOOL Encoded as JSON true or false.
INT64 Encoded as string, in decimal format.
FLOAT64 Encoded as number, or the strings "NaN", "Infinity", or "-Infinity".
TIMESTAMP

Encoded as string in RFC 3339 timestamp format. The time zone must be present, and must be "Z".

If the schema has the column option allow_commit_timestamp=true, the placeholder string "spanner.commit_timestamp()" can be used to instruct the system to insert the commit timestamp associated with the transaction commit.

DATE Encoded as string in RFC 3339 date format.
STRING Encoded as string.
BYTES Encoded as a base64-encoded string, as described in RFC 4648, section 4.
ARRAY Encoded as list, where the list elements are represented according to arrayElementType.
STRUCT Encoded as list, where list element i is represented according to structType.fields[i].

Send feedback about...

Cloud Spanner Documentation