Row(values, field_to_index)
A BigQuery row.
Values can be accessed by position (index), by key like a dict, or as properties.
Parameters
Name | Description |
values |
Sequence[object]
The row values |
field_to_index |
Dict[str, int]
A mapping from schema field names to indexes |
Inheritance
builtins.object > RowMethods
get
get(key: str, default: Optional[Any] = None)
Return a value for key, with a default value if it does not exist.
Name | Description |
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: |
Type | Description |
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 overrided 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()
Return items as (key, value)
pairs.
Type | Description |
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()
Return the keys for using a row as a dict.
Type | Description |
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.
Type | Description |
Sequence[object] | A sequence of length len(row) . |
__init__
__init__(values, field_to_index)
Initialize self. See help(type(self)) for accurate signature.
Row
Row(values, field_to_index)
A BigQuery row.
Values can be accessed by position (index), by key like a dict, or as properties.
Name | Description |
values |
Sequence[object]
The row values |
field_to_index |
Dict[str, int]
A mapping from schema field names to indexes |