# Class QueryJob (3.42.1)

3.42.1 (latest) 3.42.0 3.41.0 3.40.1 3.39.0 3.38.0 3.37.0 3.36.0 3.35.1 3.34.0 3.33.0 3.31.0 3.30.0 3.29.0 3.27.0 3.26.0 3.25.0 3.24.0 3.23.1 3.22.0 3.21.0 3.20.1 3.19.0 3.18.0 3.17.2 3.16.0 3.15.0 3.14.1 3.13.0 3.12.0 3.11.4 3.4.0 3.3.6 3.2.0 3.1.0 3.0.1 2.34.4 2.33.0 2.32.0 2.31.0 2.30.1 2.29.0 2.28.1 2.27.1 2.26.0 2.25.2 2.24.1 2.23.3 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.1 2.15.0 2.14.0 2.13.1 2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.2 2.5.0 2.4.0 2.3.1 2.2.0 2.1.0 2.0.0 1.28.2 1.27.2 1.26.1 1.25.0 1.24.0 1.23.1 1.22.0 1.21.0 1.20.0 1.19.0 1.18.0 1.17.0 1.16.0

    QueryJob(job_id, query, client, job_config=None)

Asynchronous job: query tables.

| ## Parameters ||
|---|---|
| **Name** | **Description** |
| `job_id` | `str` the job's ID, within the project belonging to `client`. |
| `query` | `str` SQL query string. |
| `client` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.client.Client` A client which holds credentials and project configuration for the dataset (which requires a project). |
| `job_config` | `Optional[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig]` Extra configuration options for the query job. |

## Properties

### allow_large_results

See
[allow_large_results](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### billing_tier

Return billing tier from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.billing_tier>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[int]` | Billing tier used by the job, or None if job is not yet complete. |

### cache_hit

Return whether or not query results were served from cache.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.cache_hit>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[bool]` | whether the query results were returned from cache, or None if job is not yet complete. |

### clustering_fields

See
[clustering_fields](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### configuration

The configuration for this query job.

### connection_properties

See
[connection_properties](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

.. versionadded:: 2.29.0

### create_disposition

See
[create_disposition](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### create_session

See
[create_session](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

.. versionadded:: 2.29.0

### created

Datetime at which the job was created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[datetime.datetime]` | the creation time (None until set from the server). |

### ddl_operation_performed

Optional\[str\]: Return the DDL operation performed.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.ddl_operation_performed>

### ddl_target_routine

Optional\[[google.cloud.bigquery.routine.RoutineReference](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.routine.RoutineReference)\]: Return the DDL target routine, present
for CREATE/DROP FUNCTION/PROCEDURE queries.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.ddl_target_routine>

### ddl_target_table

Optional\[[google.cloud.bigquery.table.TableReference](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.TableReference)\]: Return the DDL target table, present
for CREATE/DROP TABLE/VIEW queries.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.ddl_target_table>

### default_dataset

See
[default_dataset](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### destination

See
[destination](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### destination_encryption_configuration

[google.cloud.bigquery.encryption_configuration.EncryptionConfiguration](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/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](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### dry_run

See
[dry_run](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### ended

Datetime at which the job finished.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[datetime.datetime]` | the end time (None until set from the server). |

### error_result

Output only. Final error result of the job.

If present, indicates that the job has completed and was unsuccessful.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatus.FIELDS.error_result>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[Mapping]` | the error information (None until set from the server). |

### errors

Output only. The first errors encountered during the running of the job.

The final message includes the number of errors that caused the process to stop.
Errors here do not necessarily mean that the job has not completed or was unsuccessful.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatus.FIELDS.errors>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[List[Mapping]]` | the error information (None until set from the server). |

### estimated_bytes_processed

Return the estimated number of bytes processed by the query.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.estimated_bytes_processed>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[int]` | number of DML rows affected by the job, or None if job is not yet complete. |

### etag

ETag for the job resource.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[str]` | the ETag (None until set from the server). |

### flatten_results

See
[flatten_results](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### job_id

str: ID of the job.

### job_type

Type of job.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | one of 'load', 'copy', 'extract', 'query'. |

### labels

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

### location

str: Location where the job runs.

### maximum_billing_tier

See
[maximum_billing_tier](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### maximum_bytes_billed

See
[maximum_bytes_billed](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### num_child_jobs

The number of child jobs executed.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics.FIELDS.num_child_jobs>

### num_dml_affected_rows

Return the number of DML rows affected by the job.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.num_dml_affected_rows>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[int]` | number of DML rows affected by the job, or None if job is not yet complete. |

### parent_job_id

Return the ID of the parent job.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics.FIELDS.parent_job_id>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[str]` | parent job id. |

### path

URL path for the job's APIs.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | the path based on project and job ID. |

### priority

See
[priority](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### project

Project bound to the job.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | the project (derived from the client). |

### query

str: The query text used in this query job.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationQuery.FIELDS.query>

### query_id

\[Preview\] ID of a completed query.

This ID is auto-generated and not guaranteed to be populated.

### query_parameters

See
[query_parameters](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### query_plan

Return query plan from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.query_plan>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `List[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryPlanEntry]` | mappings describing the query plan, or an empty list if the query has not yet completed. |

### range_partitioning

See
[range_partitioning](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### referenced_property_graphs

Return referenced property graphs from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.referenced_property_graphs>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `List[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.PropertyGraphReference]` | mappings describing the property graphs, or an empty list if the query has not yet completed. |

### referenced_tables

Return referenced tables from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.referenced_tables>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `List[Dict]` | mappings describing the query plan, or an empty list if the query has not yet completed. |

### reservation_id

str: Name of the primary reservation assigned to this job.

Note that this could be different than reservations reported in
the reservation field if parent reservations were used to execute
this job.

### reservation_usage

Job resource usage breakdown by reservation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `List[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.ReservationUsage]` | Reservation usage stats. Can be empty if not set from the server. |

### schema

The schema of the results.

Present only for successful dry run of non-legacy SQL queries.

### schema_update_options

See
[schema_update_options](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### script_statistics

Statistics for a child job of a script.

### search_stats

Returns a SearchStats object.

### self_link

URL for the job resource.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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

### slot_millis

Union\[int, None\]: Slot-milliseconds used by this query job.

### started

Datetime at which the job was started.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[datetime.datetime]` | the start time (None until set from the server). |

### state

Output only. Running state of the job.

Valid states include 'PENDING', 'RUNNING', and 'DONE'.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatus.FIELDS.state>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[str]` | the state (None until set from the server). |

### statement_type

Return statement type from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.statement_type>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[str]` | type of statement used by the job, or None if job is not yet complete. |

### table_definitions

See
[table_definitions](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### time_partitioning

See
[time_partitioning](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### timeline

List(TimelineEntry): Return the query execution timeline
from job statistics.

### total_bytes_billed

Return total bytes billed from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.total_bytes_billed>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[int]` | Total bytes processed by the job, or None if job is not yet complete. |

### total_bytes_processed

Return total bytes processed from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.total_bytes_processed>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[int]` | Total bytes processed by the job, or None if job is not yet complete. |

### 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](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.client.Client) method with the
`parent_job` parameter to iterate over child jobs.

.. versionadded:: 2.24.0

### udf_resources

See
[udf_resources](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### undeclared_query_parameters

Return undeclared query parameters from job statistics, if present.

See:
<https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics2.FIELDS.undeclared_query_parameters>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `List[Union[ https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.query.ArrayQueryParameter, https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.query.ScalarQueryParameter, https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.query.StructQueryParameter ]]` | Undeclared parameters, or an empty list if the query has not yet completed. |

### use_legacy_sql

See
[use_legacy_sql](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### use_query_cache

See
[use_query_cache](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

### user_email

E-mail address of user who submitted the job.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[str]` | the URL (None until set from the server). |

### write_disposition

See
[write_disposition](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig).

## 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** ||
|---|---|
| **Name** | **Description** |
| `fn` | `Callable[Future]` The callback to execute when the operation is complete. |

### cancel

    cancel(
        client=None,
        retry: typing.Optional[
            google.api_core.retry.retry_unary.Retry
        ] = google.api_core.retry.retry_unary.Retry,
        timeout: typing.Optional[float] = None,
    ) -> bool

API call: cancel job via a POST request

See
<https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/cancel>

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `client` | `Optional[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/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. |
| `timeout` | `Optional[float]` The number of seconds to wait for the underlying HTTP transport before using `retry` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | Boolean 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** ||
|---|---|
| **Type** | **Description** |
| `bool` | False |

### done

    done(
        retry: google.api_core.retry.retry_unary.Retry = google.api_core.retry.retry_unary.Retry,
        timeout: typing.Optional[float] = 128,
        reload: bool = True,
    ) -> bool

Checks if the job is complete.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `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** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if the job is complete, False otherwise. |

### exception

    exception(timeout=object)

Get the exception from the operation, blocking if necessary.

See the documentation for the `result` method for details on how
this method operates, as both `result` and this method rely on the
exact same polling logic. The only difference is that this method does
not accept `retry` and `polling` arguments but relies on the default ones
instead.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `timeout` | `int` How long to wait for the operation to complete. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Optional[google.api_core.GoogleAPICallError]` | The operation's error. |

### exists

    exists(
        client=None,
        retry: google.api_core.retry.retry_unary.Retry = google.api_core.retry.retry_unary.Retry,
        timeout: typing.Optional[float] = None,
    ) -> bool

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** ||
|---|---|
| **Name** | **Description** |
| `timeout` | `Optional[float]` The number of seconds to wait for the underlying HTTP transport before using `retry`. |
| `client` | `Optional[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/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** ||
|---|---|
| **Type** | **Description** |
| `bool` | Boolean indicating existence of the job. |

### from_api_repr

    from_api_repr(resource: dict, client: Client) -> QueryJob

Factory: construct a job given its API representation

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `resource` | `Dict` dataset job representation returned from the API |
| `client` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.client.Client` Client which holds credentials and project configuration for the dataset. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `google.cloud.bigquery.job.QueryJob` | Job parsed from `resource`. |

### reload

    reload(
        client=None,
        retry: google.api_core.retry.retry_unary.Retry = google.api_core.retry.retry_unary.Retry,
        timeout: typing.Optional[float] = 128,
    )

API call: refresh job properties via a GET request.

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `timeout` | `Optional[float]` The number of seconds to wait for the underlying HTTP transport before using `retry`. |
| `client` | `Optional[https://docs.cloud.google.com/python/docs/reference/bigquery/latest/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(
        page_size: typing.Optional[int] = None,
        max_results: typing.Optional[int] = None,
        retry: typing.Optional[
            google.api_core.retry.retry_unary.Retry
        ] = google.api_core.retry.retry_unary.Retry,
        timeout: typing.Optional[typing.Union[float, object]] = object,
        start_index: typing.Optional[int] = None,
        job_retry: typing.Optional[
            google.api_core.retry.retry_unary.Retry
        ] = google.api_core.retry.retry_unary.Retry,
    ) -> typing.Union[RowIterator, google.cloud.bigquery.table._EmptyRowIterator]

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `page_size` | `Optional[int]` The maximum number of rows in each page of results from this request. Non-positive values are ignored. |
| `max_results` | `Optional[int]` The maximum total number of rows from this request. |
| `retry` | `Optional[google.api_core.retry.Retry]` How to retry the call that retrieves rows. This only applies to making RPC calls. It isn't used to retry failed jobs. This has a reasonable default that should only be overridden with care. If the job state is `DONE`, retrying is aborted early even if the results are not available, as this will not change anymore. |
| `timeout` | `Optional[Union[float, google.api_core.future.polling.PollingFuture._DEFAULT_VALUE, ]]` The number of seconds to wait for the underlying HTTP transport before using `retry`. If `None`, wait indefinitely unless an error is returned. If unset, only the underlying API calls have their default timeouts, but we still wait indefinitely for the job to finish. |
| `start_index` | `Optional[int]` The zero-based index of the starting row to read. |
| `job_retry` | `Optional[google.api_core.retry.Retry]` How to retry failed jobs. The default retries rate-limit-exceeded errors. Passing `None` disables job retry. Not all jobs can be retried. If `job_id` was provided to the query that created this job, then the job returned by the query will not be retryable, and an exception will be raised if non-`None` non-default `job_retry` is also provided. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `google.api_core.exceptions.GoogleAPICallError` | If the job failed and retries aren't successful. |
| `concurrent.futures.TimeoutError` | If the job did not complete in the given timeout. |
| `TypeError` | If Non-`None` and non-default `job_retry` is provided and the job is not retryable. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.RowIterator` | Iterator of row data [Row](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.Row)-s. During each page, the iterator will have the `total_rows` attribute set, which counts the total number of rows \*\*in the result set\*\* (this is distinct from the total number of rows in the current page: `iterator.page.num_items`). If the query is a special query that produces no results, e.g. a DDL query, an `_EmptyRowIterator` instance is returned. |

### 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`.

### to_arrow

    to_arrow(
        progress_bar_type: typing.Optional[str] = None,
        bqstorage_client: typing.Optional[bigquery_storage.BigQueryReadClient] = None,
        create_bqstorage_client: bool = True,
        max_results: typing.Optional[int] = None,
        timeout: typing.Optional[float] = None,
    ) -> pyarrow.Table

\[Beta\] Create a class:`pyarrow.Table` by loading all pages of a
table or query.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `progress_bar_type` | `Optional[str]` If set, use the `tqdm https://tqdm.github.io/`_ library to display a progress bar while the data downloads. Install the `tqdm` package to use this feature. Possible values of `progress_bar_type` include: `None` No progress bar. `'tqdm'` Use the `tqdm.tqdm` function to print a progress bar to :data:`sys.stdout`. `'tqdm_notebook'` Use the `tqdm.notebook.tqdm` function to display a progress bar as a Jupyter notebook widget. `'tqdm_gui'` Use the `tqdm.tqdm_gui` function to display a progress bar as a graphical dialog box. |
| `bqstorage_client` | `Optional[google.cloud.bigquery_storage_v1.BigQueryReadClient]` A BigQuery Storage API client. If supplied, use the faster BigQuery Storage API to fetch rows from BigQuery. This API is a billable API. This method requires `google-cloud-bigquery-storage` library. Reading from a specific partition or snapshot is not currently supported by this method. |
| `create_bqstorage_client` | `Optional[bool]` If `True` (default), create a BigQuery Storage API client using the default API settings. The BigQuery Storage API is a faster way to fetch rows from BigQuery. See the `bqstorage_client` parameter for more information. This argument does nothing if `bqstorage_client` is supplied. .. versionadded:: 1.24.0 |
| `max_results` | `Optional[int]` Maximum number of rows to include in the result. No limit by default. .. versionadded:: 2.21.0 |
| `timeout` | `Optional[float]` The number of seconds to wait for the underlying download to complete. If `None`, wait indefinitely. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `ValueError` | If the `pyarrow` library cannot be imported. .. versionadded:: 1.17.0 |

### to_dataframe

    to_dataframe(
        bqstorage_client: typing.Optional[bigquery_storage.BigQueryReadClient] = None,
        dtypes: typing.Optional[typing.Dict[str, typing.Any]] = None,
        progress_bar_type: typing.Optional[str] = None,
        create_bqstorage_client: bool = True,
        max_results: typing.Optional[int] = None,
        geography_as_object: bool = False,
        bool_dtype: typing.Optional[typing.Any] = DefaultPandasDTypes.BOOL_DTYPE,
        int_dtype: typing.Optional[typing.Any] = DefaultPandasDTypes.INT_DTYPE,
        float_dtype: typing.Optional[typing.Any] = None,
        string_dtype: typing.Optional[typing.Any] = None,
        date_dtype: typing.Optional[typing.Any] = DefaultPandasDTypes.DATE_DTYPE,
        datetime_dtype: typing.Optional[typing.Any] = None,
        time_dtype: typing.Optional[typing.Any] = DefaultPandasDTypes.TIME_DTYPE,
        timestamp_dtype: typing.Optional[typing.Any] = None,
        range_date_dtype: typing.Optional[
            typing.Any
        ] = DefaultPandasDTypes.RANGE_DATE_DTYPE,
        range_datetime_dtype: typing.Optional[
            typing.Any
        ] = DefaultPandasDTypes.RANGE_DATETIME_DTYPE,
        range_timestamp_dtype: typing.Optional[
            typing.Any
        ] = DefaultPandasDTypes.RANGE_TIMESTAMP_DTYPE,
        timeout: typing.Optional[float] = None,
    ) -> pandas.DataFrame

Return a pandas DataFrame from a QueryJob

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `bqstorage_client` | `Optional[google.cloud.bigquery_storage_v1.BigQueryReadClient]` A BigQuery Storage API client. If supplied, use the faster BigQuery Storage API to fetch rows from BigQuery. This API is a billable API. This method requires the `fastavro` and `google-cloud-bigquery-storage` libraries. Reading from a specific partition or snapshot is not currently supported by this method. |
| `dtypes` | `Optional[Map[str, Union[str, pandas.Series.dtype]]]` A dictionary of column names pandas `dtype`s. The provided `dtype` is used when constructing the series for the column specified. Otherwise, the default pandas behavior is used. |
| `progress_bar_type` | `Optional[str]` If set, use the `tqdm https://tqdm.github.io/`_ library to display a progress bar while the data downloads. Install the `tqdm` package to use this feature. See [to_dataframe](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.RowIterator) for details. .. versionadded:: 1.11.0 |
| `create_bqstorage_client` | `Optional[bool]` If `True` (default), create a BigQuery Storage API client using the default API settings. The BigQuery Storage API is a faster way to fetch rows from BigQuery. See the `bqstorage_client` parameter for more information. This argument does nothing if `bqstorage_client` is supplied. .. versionadded:: 1.24.0 |
| `max_results` | `Optional[int]` Maximum number of rows to include in the result. No limit by default. .. versionadded:: 2.21.0 |
| `geography_as_object` | `Optional[bool]` If `True`, convert GEOGRAPHY data to `shapely` geometry objects. If `False` (default), don't cast geography data to `shapely` geometry objects. .. versionadded:: 2.24.0 |
| `bool_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.BooleanDtype()`) to convert BigQuery Boolean type, instead of relying on the default `pandas.BooleanDtype()`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("bool")`. BigQuery Boolean type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#boolean_type> .. versionadded:: 3.8.0 |
| `int_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.Int64Dtype()`) to convert BigQuery Integer types, instead of relying on the default `pandas.Int64Dtype()`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("int64")`. A list of BigQuery Integer types can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#integer_types> .. versionadded:: 3.8.0 |
| `float_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.Float32Dtype()`) to convert BigQuery Float type, instead of relying on the default `numpy.dtype("float64")`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("float64")`. BigQuery Float type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#floating_point_types> .. versionadded:: 3.8.0 |
| `string_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.StringDtype()`) to convert BigQuery String type, instead of relying on the default `numpy.dtype("object")`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("object")`. BigQuery String type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#string_type> .. versionadded:: 3.8.0 |
| `date_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.ArrowDtype(pyarrow.date32())`) to convert BigQuery Date type, instead of relying on the default `db_dtypes.DateDtype()`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("datetime64[ns]")` or `object` if out of bound. BigQuery Date type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#date_type> .. versionadded:: 3.10.0 |
| `datetime_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.ArrowDtype(pyarrow.timestamp("us"))`) to convert BigQuery Datetime type, instead of relying on the default `numpy.dtype("datetime64[ns]`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("datetime64[ns]")` or `object` if out of bound. BigQuery Datetime type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#datetime_type> .. versionadded:: 3.10.0 |
| `time_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.ArrowDtype(pyarrow.time64("us"))`) to convert BigQuery Time type, instead of relying on the default `db_dtypes.TimeDtype()`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("object")`. BigQuery Time type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#time_type> .. versionadded:: 3.10.0 |
| `timestamp_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.ArrowDtype(pyarrow.timestamp("us", tz="UTC"))`) to convert BigQuery Timestamp type, instead of relying on the default `numpy.dtype("datetime64[ns, UTC]")`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("datetime64[ns, UTC]")` or `object` if out of bound. BigQuery Datetime type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#timestamp_type> .. versionadded:: 3.10.0 |
| `range_date_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype, such as: .. code-block:: python pandas.ArrowDtype(pyarrow.struct( \[("start", pyarrow.date32()), ("end", pyarrow.date32())\] )) to convert BigQuery RANGE |
| `range_datetime_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype, such as: .. code-block:: python pandas.ArrowDtype(pyarrow.struct( \[ ("start", pyarrow.timestamp("us")), ("end", pyarrow.timestamp("us")), \] )) to convert BigQuery RANGE |
| `range_timestamp_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype, such as: .. code-block:: python pandas.ArrowDtype(pyarrow.struct( \[ ("start", pyarrow.timestamp("us", tz="UTC")), ("end", pyarrow.timestamp("us", tz="UTC")), \] )) to convert BigQuery RANGE |
| `timeout` | `Optional[float]` The number of seconds to wait for the underlying download to complete. If `None`, wait indefinitely. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `ValueError` | If the `pandas` library cannot be imported, or the bigquery_storage_v1 module is required but cannot be imported. Also if `geography_as_object` is `True`, but the `shapely` library cannot be imported. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `pandas.DataFrame` | A `pandas.DataFrame` populated with row data and column headers from the query results. The column headers are derived from the destination table's schema. |

### to_geodataframe

    to_geodataframe(
        bqstorage_client: typing.Optional[bigquery_storage.BigQueryReadClient] = None,
        dtypes: typing.Optional[typing.Dict[str, typing.Any]] = None,
        progress_bar_type: typing.Optional[str] = None,
        create_bqstorage_client: bool = True,
        max_results: typing.Optional[int] = None,
        geography_column: typing.Optional[str] = None,
        bool_dtype: typing.Optional[typing.Any] = DefaultPandasDTypes.BOOL_DTYPE,
        int_dtype: typing.Optional[typing.Any] = DefaultPandasDTypes.INT_DTYPE,
        float_dtype: typing.Optional[typing.Any] = None,
        string_dtype: typing.Optional[typing.Any] = None,
        timeout: typing.Optional[float] = None,
    ) -> geopandas.GeoDataFrame

Return a GeoPandas GeoDataFrame from a QueryJob

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `bqstorage_client` | `Optional[google.cloud.bigquery_storage_v1.BigQueryReadClient]` A BigQuery Storage API client. If supplied, use the faster BigQuery Storage API to fetch rows from BigQuery. This API is a billable API. This method requires the `fastavro` and `google-cloud-bigquery-storage` libraries. Reading from a specific partition or snapshot is not currently supported by this method. |
| `dtypes` | `Optional[Map[str, Union[str, pandas.Series.dtype]]]` A dictionary of column names pandas `dtype`s. The provided `dtype` is used when constructing the series for the column specified. Otherwise, the default pandas behavior is used. |
| `progress_bar_type` | `Optional[str]` If set, use the `tqdm https://tqdm.github.io/`_ library to display a progress bar while the data downloads. Install the `tqdm` package to use this feature. See [to_dataframe](https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.RowIterator) for details. .. versionadded:: 1.11.0 |
| `create_bqstorage_client` | `Optional[bool]` If `True` (default), create a BigQuery Storage API client using the default API settings. The BigQuery Storage API is a faster way to fetch rows from BigQuery. See the `bqstorage_client` parameter for more information. This argument does nothing if `bqstorage_client` is supplied. .. versionadded:: 1.24.0 |
| `max_results` | `Optional[int]` Maximum number of rows to include in the result. No limit by default. .. versionadded:: 2.21.0 |
| `geography_column` | `Optional[str]` If there are more than one GEOGRAPHY column, identifies which one to use to construct a GeoPandas GeoDataFrame. This option can be ommitted if there's only one GEOGRAPHY column. |
| `bool_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.BooleanDtype()`) to convert BigQuery Boolean type, instead of relying on the default `pandas.BooleanDtype()`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("bool")`. BigQuery Boolean type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#boolean_type> |
| `int_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.Int64Dtype()`) to convert BigQuery Integer types, instead of relying on the default `pandas.Int64Dtype()`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("int64")`. A list of BigQuery Integer types can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#integer_types> |
| `float_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.Float32Dtype()`) to convert BigQuery Float type, instead of relying on the default `numpy.dtype("float64")`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("float64")`. BigQuery Float type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#floating_point_types> |
| `string_dtype` | `Optional[pandas.Series.dtype, None]` If set, indicate a pandas ExtensionDtype (e.g. `pandas.StringDtype()`) to convert BigQuery String type, instead of relying on the default `numpy.dtype("object")`. If you explicitly set the value to `None`, then the data type will be `numpy.dtype("object")`. BigQuery String type can be found at: <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#string_type> |
| `timeout` | `Optional[float]` The number of seconds to wait for the underlying download to complete. If `None`, wait indefinitely. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `ValueError` | If the `geopandas` library cannot be imported, or the bigquery_storage_v1 module is required but cannot be imported. .. versionadded:: 2.24.0 |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `geopandas.GeoDataFrame` | A `geopandas.GeoDataFrame` populated with row data and column headers from the query results. The column headers are derived from the destination table's schema. |