Class Row (3.20.1)

Row(values, field_to_index)

A BigQuery row.

Values can be accessed by position (index), by key like a dict, or as properties.

Parameters

NameDescription
values Sequence[object]

The row values

field_to_index Dict[str, int]

A mapping from schema field names to indexes

Methods

get

get(key: str, default: typing.Optional[typing.Any] = None) -> typing.Any

Return a value for key, with a default value if it does not exist.

Parameters
NameDescription
key str

The key of the column to access

default object

The default value to use if the key does not exist. (Defaults to :data:None.)

Returns
TypeDescription
object .. rubric:: Examples When the key exists, the value associated with it is returned. >>> Row(('a', 'b'), {'x': 0, 'y': 1}).get('x') 'a' The default value is :data:None when the key does not exist. >>> Row(('a', 'b'), {'x': 0, 'y': 1}).get('z') None The default value can be overridden with the default parameter. >>> Row(('a', 'b'), {'x': 0, 'y': 1}).get('z', '') '' >>> Row(('a', 'b'), {'x': 0, 'y': 1}).get('z', default = '') ''The value associated with the provided key, or a default value.

items

items() -> typing.Iterable[typing.Tuple[str, typing.Any]]

Return items as (key, value) pairs.

Returns
TypeDescription
Iterable[Tuple[str, object]] .. rubric:: Examples >>> list(Row(('a', 'b'), {'x': 0, 'y': 1}).items()) [('x', 'a'), ('y', 'b')]The (key, value) pairs representing this row.

keys

keys() -> typing.Iterable[str]

Return the keys for using a row as a dict.

Returns
TypeDescription
Iterable[str] .. rubric:: Examples >>> list(Row(('a', 'b'), {'x': 0, 'y': 1}).keys()) ['x', 'y']The keys corresponding to the columns of a row

values

values()

Return the values included in this row.

Returns
TypeDescription
Sequence[object]A sequence of length len(row).