public sealed class BigQueryInsertRow : IEnumerable
Reference documentation and code samples for the Google BigQuery v2 API class BigQueryInsertRow.
A row used for streaming data insertion.
Implements
IEnumerableNamespace
GoogleGoogle.CloudGoogle.Cloud.BigQueryV2Assembly
Google.Cloud.BigQuery.V2.dll
Remarks
This is effectively a dictionary where each key is the field name (a string) and the value is the corresponding value for that field. Supported value types:
System.Boolean
System.Int16
System.UInt16
System.Int32
System.UInt32
System.Int64
System.Float
System.Double
System.String
System.DateTime
System.DateTimeOffset
System.TimeSpan
Google.Cloud.BigQuery.V2.BigQueryNumeric
Google.Cloud.BigQuery.V2.BigQueryGeography
- A
Google.Cloud.BigQuery.V2.InsertRow
(for record/struct fields) - Any
IReadOnlyList<T>
of one of the above types (for repeated fields). This includes arrays andList<T>
values.
Note that all integer types are stored as System.Int64
, and all floating point
types are stored as System.Double.
DateTimeOffset
values are converted to UTC and treated as timestamp. The handling
of DateTime
values depends on the Kind
: values with a Kind
of Local
are rejected;
values with a Kind
of UTC
are treated as timestamps; values with a Kind
of Unspecified
are treated as civil datetime values. All values are stored with a precision of a microsecond.
TimeSpan
values must be non-negative and less than 24 hours, used to represent a time-of-day.
Although date values are retrieved as System.DateTime
, they must be inserted as string values, in the format
"yyyy-MM-dd".
BigQueryInsertRow is used for record/struct fields for convenience, but only the InsertId of the top-level row is relevant.
Null elements within repeated fields are prohibited. This is validated client-side when the row is inserted; validating when a value is added to the row would be ineffective as the values could change before insertion.
Constructors
BigQueryInsertRow()
public BigQueryInsertRow()
Constructs an empty row with no insert ID.
BigQueryInsertRow(string)
public BigQueryInsertRow(string insertId)
Constructs an empty row with the specified insert ID.
Parameter | |
---|---|
Name | Description |
insertId | string Insert ID used for deduplication. May be null. |
Properties
InsertId
public string InsertId { get; set; }
To help ensure data consistency, you can supply an InsertId for each inserted row. BigQuery remembers this ID for at least one minute. If you try to stream the same set of rows within that time period and the insertId property is set, BigQuery uses the property to de-duplicate your data on a best effort basis. By default if no ID is specified, one will be generated to allow de-duplicating efforts if insert operations need to be retried. You can allow empty InsertId by setting AllowEmptyInsertIds to true. This will allow for faster row inserts at the expense of possible record duplication if the operation needs to be retried. See https://cloud.google.com/bigquery/quotas#streaming_inserts for more information.
Property Value | |
---|---|
Type | Description |
string |
this[string]
public object this[string name] { get; set; }
Accesses a field in the row by name.
Parameter | |
---|---|
Name | Description |
name | string The name of the field to access. Must be a valid BigQuery field name. |
Property Value | |
---|---|
Type | Description |
object | The value associated with |
Exceptions | |
---|---|
Type | Description |
KeyNotFoundException | The row does not have a key with the given name. |
Methods
Add(IDictionary<string, object>)
public void Add(IDictionary<string, object> fields)
Adds all the values in the specified dictionary to the row.
Parameter | |
---|---|
Name | Description |
fields | IDictionarystringobject The fields to add to the row. Must not be null. |
This being named Add
rather than AddRange
allows
it to be specified in a collection initializer, which can be useful
to provide a set of common fields and then some extra values.
Add(string, object)
public void Add(string key, object value)
Adds a single field value to the row.
Parameters | |
---|---|
Name | Description |
key | string The name of the field. Must be a valid BigQuery field name. |
value | object The value for the field, which must be |