google.cloud.bigquery.job.LoadJobConfig¶
- class google.cloud.bigquery.job.LoadJobConfig(**kwargs)[source]¶
Configuration options for load jobs.
Set properties on the constructed configuration by using the property name as the name of a keyword argument. Values which are unset or
None
use the BigQuery REST API default values. See the BigQuery REST API reference documentation for a list of default values.Required options differ based on the
source_format
value. For example, the BigQuery API’s default value forsource_format
is"CSV"
. When loading a CSV file, eitherschema
must be set orautodetect
must be set toTrue
.Methods
__init__
(**kwargs)Initialize self.
from_api_repr
(resource)Factory: construct a job configuration given its API representation
Build an API representation of the job config.
Attributes
Allow missing trailing optional columns (CSV only).
Allow quoted data containing newline characters (CSV only).
Automatically infer the schema from a sample of the data.
Fields defining clustering for the table
Connection properties.
Specifies behavior for creating tables.
[Preview] If
True
, creates a new session, wheresession_info
will contain a random server generated session id.Possible SQL data types to which the source decimal values are converted.
Custom encryption configuration for the destination table.
Description of the destination table.
Name given to destination table.
The character encoding of the data.
The separator for fields in a CSV file.
[Beta] When set, it configures hive partitioning support.
Ignore extra values not represented in the table schema.
Optional parameter.
The extension to use for writing JSON data to BigQuery.
Labels for the job.
Number of invalid rows to ignore.
Represents a null value (CSV only).
Additional
Preserves the embedded ASCII control characters when sourceFormat is set to CSV.
If
google.cloud.bigquery.job.LoadJobConfig.source_format
is set to “DATASTORE_BACKUP”, indicates which entity properties to load into BigQuery from a Cloud Datastore backup.Character used to quote data sections (CSV only).
Optional[google.cloud.bigquery.table.RangePartitioning]: Configures range-based partitioning for destination table.
Optional[str]: When creating an external table, the user can provide a reference file with the table schema.
Schema of the destination table.
Specifies updates to the destination table schema to allow as a side effect of the load job.
Number of rows to skip when reading data (CSV only).
File format of the data.
Specifies time-based partitioning for the destination table.
For loads of Avro data, governs whether Avro logical types are converted to their corresponding BigQuery types (e.g.
Action that occurs if the destination table already exists.
- __setattr__(name, value)¶
Override to be able to raise error if an unknown property is being set
- property allow_quoted_newlines¶
Allow quoted data containing newline characters (CSV only).
- Type
Optional[bool]
- property autodetect¶
Automatically infer the schema from a sample of the data.
See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.autodetect
- Type
Optional[bool]
- property clustering_fields¶
Fields defining clustering for the table
(Defaults to
None
).Clustering fields are immutable after table creation.
Note
BigQuery supports clustering for both partitioned and non-partitioned tables.
- Type
Optional[List[str]]
- property connection_properties: List[google.cloud.bigquery.query.ConnectionProperty]¶
Connection properties.
New in version 3.7.0.
- property create_disposition¶
Specifies behavior for creating tables.
- Type
- property create_session: Optional[bool]¶
[Preview] If
True
, creates a new session, wheresession_info
will contain a random server generated session id.If
False
, runs load job with an existingsession_id
passed inconnection_properties
, otherwise runs load job in non-session mode.New in version 3.7.0.
- property decimal_target_types: Optional[FrozenSet[str]]¶
Possible SQL data types to which the source decimal values are converted.
New in version 2.21.0.
- property destination_encryption_configuration¶
Custom encryption configuration for the destination table.
Custom encryption configuration (e.g., Cloud KMS keys) or
None
if using default encryption.
- property encoding¶
The character encoding of the data.
See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.encoding
- Type
Optional[google.cloud.bigquery.job.Encoding]
- classmethod from_api_repr(resource: dict) → google.cloud.bigquery.job.base._JobConfig¶
Factory: construct a job configuration given its API representation
- Parameters
resource (Dict) – A job configuration in the same representation as is returned from the API.
- Returns
Configuration parsed from
resource
.- Return type
google.cloud.bigquery.job._JobConfig
- property hive_partitioning¶
[Beta] When set, it configures hive partitioning support.
Note
Experimental. This feature is experimental and might change or have limited support.
- Type
Optional[
HivePartitioningOptions
]
- property ignore_unknown_values¶
Ignore extra values not represented in the table schema.
- Type
Optional[bool]
- property job_timeout_ms¶
Optional parameter. Job timeout in milliseconds. If this time limit is exceeded, BigQuery might attempt to stop the job. https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfiguration.FIELDS.job_timeout_ms e.g.
job_config = bigquery.QueryJobConfig( job_timeout_ms = 5000 ) or job_config.job_timeout_ms = 5000
- Raises
ValueError – If
value
type is invalid.
- property json_extension¶
The extension to use for writing JSON data to BigQuery. Only supports GeoJSON currently.
- Type
Optional[str]
- property labels¶
Labels for the job.
This method always returns a dict. Once a job has been created on the server, its labels cannot be modified anymore.
- Raises
ValueError – If
value
type is invalid.- Type
- property null_marker¶
Represents a null value (CSV only).
See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.null_marker
- Type
Optional[str]
- property parquet_options¶
- Additional
properties to set if
sourceFormat
is set to PARQUET.
- Type
Optional[google.cloud.bigquery.format_options.ParquetOptions]
- property preserve_ascii_control_characters¶
Preserves the embedded ASCII control characters when sourceFormat is set to CSV.
- Type
Optional[bool]
- property projection_fields: Optional[List[str]]¶
If
google.cloud.bigquery.job.LoadJobConfig.source_format
is set to “DATASTORE_BACKUP”, indicates which entity properties to load into BigQuery from a Cloud Datastore backup.Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn’t found in the Cloud Datastore backup, an invalid error is returned in the job result.
- Type
Optional[List[str]]
- property quote_character¶
Character used to quote data sections (CSV only).
See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.quote
- Type
Optional[str]
- property range_partitioning¶
Optional[google.cloud.bigquery.table.RangePartitioning]: Configures range-based partitioning for destination table.
Note
Beta. The integer range partitioning feature is in a pre-release state and might change or have limited support.
Only specify at most one of
time_partitioning
orrange_partitioning
.- Raises
ValueError – If the value is not
RangePartitioning
orNone
.
- property reference_file_schema_uri¶
Optional[str]: When creating an external table, the user can provide a reference file with the table schema. This is enabled for the following formats:
AVRO, PARQUET, ORC
- property schema¶
Schema of the destination table.
See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.schema
- Type
Optional[Sequence[Union[
SchemaField
, Mapping[str, Any] ]]]
- property schema_update_options¶
Specifies updates to the destination table schema to allow as a side effect of the load job.
- Type
Optional[List[google.cloud.bigquery.job.SchemaUpdateOption]]
- property source_format¶
File format of the data.
- Type
Optional[google.cloud.bigquery.job.SourceFormat]
- property time_partitioning¶
Specifies time-based partitioning for the destination table.
Only specify at most one of
time_partitioning
orrange_partitioning
.- Type
- to_api_repr() → dict¶
Build an API representation of the job config.
- Returns
A dictionary in the format used by the BigQuery API.
- Return type
Dict
- property use_avro_logical_types¶
For loads of Avro data, governs whether Avro logical types are converted to their corresponding BigQuery types (e.g. TIMESTAMP) rather than raw types (e.g. INTEGER).
- Type
Optional[bool]
- property write_disposition¶
Action that occurs if the destination table already exists.
- Type