BigQuery Client - Class ExtractJobConfiguration (1.30.1)

Reference documentation and code samples for the BigQuery Client class ExtractJobConfiguration.

Represents a configuration for an extract job. For more information on the available settings please see the Jobs configuration API documentation.

Example:

use Google\Cloud\BigQuery\BigQueryClient;

$bigQuery = new BigQueryClient();
$table = $bigQuery->dataset('my_dataset')
    ->table('my_table');
$extractJobConfig = $table->extract('gs://my_bucket/target.csv');

Namespace

Google \ Cloud \ BigQuery

Methods

__construct

Parameters
NameDescription
projectId string

The project's ID.

config array

A set of configuration options for a job.

location string|null

The geographic location in which the job is executed.

compression

Sets the compression type to use for exported files.

Not applicable when extracting models.

Example:

$extractJobConfig->compression('GZIP');
Parameter
NameDescription
compression string

The compression type. Acceptable values include "GZIP", "NONE". Defaults to "NONE".

Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

destinationFormat

Sets the exported file format. Tables with nested or repeated fields cannot be exported as CSV.

Example:

$extractJobConfig->destinationFormat('NEWLINE_DELIMITED_JSON');
Parameter
NameDescription
destinationFormat string

The exported file format. Acceptable values for tables include CSV, NEWLINE_DELIMITED_JSON, AVRO. For models, acceptable values include ML_TF_SAVED_MODEL and ML_XGBOOST_BOOSTER. Defaults to CSV for tables, or ML_TF_SAVED_MODEL for models.

Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

destinationUris

Sets a list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.

Example:

$extractJobConfig->destinationUris([
    'gs://my_bucket/destination.csv'
]);
Parameter
NameDescription
destinationUris array

The destination URIs.

Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

fieldDelimiter

Sets the delimiter to use between fields in the exported data.

Not applicable when extracting models.

Example:

$extractJobConfig->fieldDelimiter(',');
Parameter
NameDescription
fieldDelimiter string

The field delimiter. Defaults to ",".

Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

printHeader

Sets whether or not to print out a header row in the results.

Not applicable when extracting models.

Example:

$extractJobConfig->printHeader(false);
Parameter
NameDescription
printHeader bool

Whether or not to print out a header row. Defaults to true.

Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

sourceTable

Sets a reference to the table being exported.

Cannot be used in the same job as Google\Cloud\BigQuery\ExtractJobConfiguration::sourceModel().

Example:

$table = $bigQuery->dataset('my_dataset')
    ->table('my_table');
$extractJobConfig->sourceTable($table);
Parameter
NameDescription
sourceTable Google\Cloud\BigQuery\Table
Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

sourceModel

Sets a reference to the model being exported.

Cannot be used in the same job as Google\Cloud\BigQuery\ExtractJobConfiguration::sourceTable().

Example:

$model = $bigQuery->dataset('my_dataset')
    ->model('my_model');
$extractJobConfig->sourceModel($model);
Parameter
NameDescription
sourceModel Google\Cloud\BigQuery\Model
Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration

useAvroLogicalTypes

Sets whether to use logical types when extracting to AVRO format.

If destinationFormat is set to "AVRO", this flag indicates whether to enable extracting applicable column types (such as TIMESTAMP) to their corresponding AVRO logical types (timestamp-micros), instead of only using their raw types (avro-long).

Not applicable when extracting models.

Example:

$extractJobConfig->useAvroLogicalTypes(true);
Parameter
NameDescription
useAvroLogicalTypes bool
Returns
TypeDescription
Google\Cloud\BigQuery\ExtractJobConfiguration