Class LoadJob (3.3.0)

LoadJob(job_id, source_uris, destination, client, job_config=None)

Asynchronous job for loading data into a table.

Can load from Google Cloud Storage URIs or from a file.

Parameters

NameDescription
job_id str

the job's ID

source_uris Optional[Sequence[str]]

URIs of one or more data files to be loaded. See https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.source_uris for supported URI formats. Pass None for jobs that load from a file.

destination google.cloud.bigquery.table.TableReference

reference to table into which data is to be loaded.

client google.cloud.bigquery.client.Client

A client which holds credentials and project configuration for the dataset (which requires a project).

Inheritance

builtins.object > google.api_core.future.base.Future > google.api_core.future.polling.PollingFuture > google.cloud.bigquery.job.base._AsyncJob > LoadJob

Properties

allow_jagged_rows

allow_quoted_newlines

autodetect

clustering_fields

create_disposition

created

Datetime at which the job was created.

Returns
TypeDescription
Optional[datetime.datetime]the creation time (None until set from the server).

destination

destination_encryption_configuration

google.cloud.bigquery.encryption_configuration.EncryptionConfiguration: Custom encryption configuration for the destination table.

Custom encryption configuration (e.g., Cloud KMS keys) or :data:None if using default encryption.

See destination_encryption_configuration.

destination_table_description

destination_table_friendly_name

encoding

See encoding.

ended

Datetime at which the job finished.

Returns
TypeDescription
Optional[datetime.datetime]the end time (None until set from the server).

error_result

Error information about the job as a whole.

Returns
TypeDescription
Optional[Mapping]the error information (None until set from the server).

errors

Information about individual errors generated by the job.

Returns
TypeDescription
Optional[List[Mapping]]the error information (None until set from the server).

etag

ETag for the job resource.

Returns
TypeDescription
Optional[str]the ETag (None until set from the server).

field_delimiter

ignore_unknown_values

input_file_bytes

Count of bytes loaded from source files.

Exceptions
TypeDescription
ValueErrorfor invalid value types.
Returns
TypeDescription
Optional[int]the count (None until set from the server).

input_files

Count of source files.

Returns
TypeDescription
Optional[int]the count (None until set from the server).

job_id

str: ID of the job.

job_type

Type of job.

Returns
TypeDescription
strone of 'load', 'copy', 'extract', 'query'.

labels

Dict[str, str]: Labels for the job.

location

str: Location where the job runs.

max_bad_records

null_marker

num_child_jobs

output_bytes

Count of bytes saved to destination table.

Returns
TypeDescription
Optional[int]the count (None until set from the server).

output_rows

Count of rows saved to destination table.

Returns
TypeDescription
Optional[int]the count (None until set from the server).

parent_job_id

Returns
TypeDescription
Optional[str]parent job id.

path

URL path for the job's APIs.

Returns
TypeDescription
strthe path based on project and job ID.

project

Project bound to the job.

Returns
TypeDescription
strthe project (derived from the client).

quote_character

range_partitioning

reservation_usage

Job resource usage breakdown by reservation.

Returns
TypeDescription
List[google.cloud.bigquery.job.ReservationUsage]Reservation usage stats. Can be empty if not set from the server.

schema

See schema.

schema_update_options

script_statistics

Statistics for a child job of a script.

URL for the job resource.

Returns
TypeDescription
Optional[str]the URL (None until set from the server).

session_info

[Preview] Information of the session if this job is part of one.

.. versionadded:: 2.29.0

skip_leading_rows

source_format

source_uris

Optional[Sequence[str]]: URIs of data files to be loaded. See https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.source_uris for supported URI formats. None for jobs that load from a file.

started

Datetime at which the job was started.

Returns
TypeDescription
Optional[datetime.datetime]the start time (None until set from the server).

state

Status of the job.

Returns
TypeDescription
Optional[str]the state (None until set from the server).

time_partitioning

transaction_info

Information of the multi-statement transaction if this job is part of one.

Since a scripting query job can execute multiple transactions, this property is only expected on child jobs. Use the list_jobs method with the parent_job parameter to iterate over child jobs.

.. versionadded:: 2.24.0

use_avro_logical_types

user_email

E-mail address of user who submitted the job.

Returns
TypeDescription
Optional[str]the URL (None until set from the server).

write_disposition

Methods

add_done_callback

add_done_callback(fn)

Add a callback to be executed when the operation is complete.

If the operation is not already complete, this will start a helper thread to poll for the status of the operation in the background.

Parameter
NameDescription
fn Callable[Future]

The callback to execute when the operation is complete.

cancel

cancel(client=None, retry: retries.Retry = <google.api_core.retry.Retry object>, timeout: float = None)
Parameters
NameDescription
timeout Optional[float]

The number of seconds to wait for the underlying HTTP transport before using retry

client Optional[google.cloud.bigquery.client.Client]

the client to use. If not passed, falls back to the client stored on the current dataset.

retry Optional[google.api_core.retry.Retry]

How to retry the RPC.

Returns
TypeDescription
boolBoolean indicating that the cancel request was sent.

cancelled

cancelled()

Check if the job has been cancelled.

This always returns False. It's not possible to check if a job was cancelled in the API. This method is here to satisfy the interface for google.api_core.future.Future.

Returns
TypeDescription
boolFalse

done

done(retry: retries.Retry = <google.api_core.retry.Retry object>, timeout: float = None, reload: bool = True)

Checks if the job is complete.

Parameters
NameDescription
timeout Optional[float]

The number of seconds to wait for the underlying HTTP transport before using retry.

reload Optional[bool]

If True, make an API call to refresh the job state of unfinished jobs before checking. Default True.

retry Optional[google.api_core.retry.Retry]

How to retry the RPC. If the job state is DONE, retrying is aborted early, as the job will not change anymore.

Returns
TypeDescription
boolTrue if the job is complete, False otherwise.

exception

exception(timeout=None)

Get the exception from the operation, blocking if necessary.

Parameter
NameDescription
timeout int

How long to wait for the operation to complete. If None, wait indefinitely.

Returns
TypeDescription
Optional[google.api_core.GoogleAPICallError]The operation's error.

exists

exists(client=None, retry: retries.Retry = <google.api_core.retry.Retry object>, timeout: float = None)

API call: test for the existence of the job via a GET request

See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/get

Parameters
NameDescription
timeout Optional[float]

The number of seconds to wait for the underlying HTTP transport before using retry.

client Optional[google.cloud.bigquery.client.Client]

the client to use. If not passed, falls back to the client stored on the current dataset.

retry Optional[google.api_core.retry.Retry]

How to retry the RPC.

Returns
TypeDescription
boolBoolean indicating existence of the job.

from_api_repr

from_api_repr(resource: dict, client)

Factory: construct a job given its API representation

Parameters
NameDescription
resource Dict

dataset job representation returned from the API

client google.cloud.bigquery.client.Client

Client which holds credentials and project configuration for the dataset.

Returns
TypeDescription
google.cloud.bigquery.job.LoadJobJob parsed from ``resource``.

reload

reload(client=None, retry: retries.Retry = <google.api_core.retry.Retry object>, timeout: float = None)

API call: refresh job properties via a GET request.

See https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/get

Parameters
NameDescription
timeout Optional[float]

The number of seconds to wait for the underlying HTTP transport before using retry.

client Optional[google.cloud.bigquery.client.Client]

the client to use. If not passed, falls back to the client stored on the current dataset.

retry Optional[google.api_core.retry.Retry]

How to retry the RPC.

result

result(retry: retries.Retry = <google.api_core.retry.Retry object>, timeout: float = None)

Start the job and wait for it to complete and get the result.

Parameters
NameDescription
timeout Optional[float]

The number of seconds to wait for the underlying HTTP transport before using retry. If multiple requests are made under the hood, timeout applies to each individual request.

retry Optional[google.api_core.retry.Retry]

How to retry the RPC. If the job state is DONE, retrying is aborted early, as the job will not change anymore.

Exceptions
TypeDescription
google.cloud.exceptions.GoogleAPICallErrorif the job failed.
concurrent.futures.TimeoutErrorif the job did not complete in the given timeout.
Returns
TypeDescription
_AsyncJobThis instance.

running

running()

True if the operation is currently running.

set_exception

set_exception(exception)

Set the Future's exception.

set_result

set_result(result)

Set the Future's result.

to_api_repr

to_api_repr()

Generate a resource for _begin.

__init__

__init__(job_id, source_uris, destination, client, job_config=None)

Initialize self. See help(type(self)) for accurate signature.

LoadJob

LoadJob(job_id, source_uris, destination, client, job_config=None)

Asynchronous job for loading data into a table.

Can load from Google Cloud Storage URIs or from a file.

Parameters
NameDescription
job_id str

the job's ID

source_uris Optional[Sequence[str]]

URIs of one or more data files to be loaded. See https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.source_uris for supported URI formats. Pass None for jobs that load from a file.

destination google.cloud.bigquery.table.TableReference

reference to table into which data is to be loaded.

client google.cloud.bigquery.client.Client

A client which holds credentials and project configuration for the dataset (which requires a project).