BigQuery Client - Class CopyJobConfiguration (1.31.1)

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

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

Example:

use Google\Cloud\BigQuery\BigQueryClient;

$bigQuery = new BigQueryClient();
$sourceTable = $bigQuery->dataset('my_dataset')
    ->table('my_source_table');
$destinationTable = $bigQuery->dataset('my_dataset')
    ->table('my_destination_table');

$copyJobConfig = $sourceTable->copy($destinationTable);

Namespace

Google \ Cloud \ BigQuery

Methods

__construct

Parameters
Name Description
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.

createDisposition

Set whether the job is allowed to create new tables. Creation, truncation and append actions occur as one atomic update upon job completion.

Example:

$copyJobConfig->createDisposition('CREATE_NEVER');
Parameter
Name Description
createDisposition string

The create disposition. Acceptable values include "CREATED_IF_NEEDED", "CREATE_NEVER". Defaults to "CREATE_IF_NEEDED".

Returns
Type Description
CopyJobConfiguration

destinationEncryptionConfiguration

Sets the custom encryption configuration (e.g., Cloud KMS keys).

Example:

$copyJobConfig->destinationEncryptionConfiguration([
    'kmsKeyName' => 'my_key'
]);
Parameter
Name Description
configuration array

Custom encryption configuration.

Returns
Type Description
CopyJobConfiguration

destinationTable

Sets the destination table.

Example:

$table = $bigQuery->dataset('my_dataset')
    ->table('my_table');
$copyJobConfig->destinationTable($table);
Parameter
Name Description
destinationTable Table

The destination table.

Returns
Type Description
CopyJobConfiguration

sourceTable

Sets the source table to copy.

Example:

$table = $bigQuery->dataset('my_dataset')
    ->table('source_table');
$copyJobConfig->sourceTable($table);
Parameter
Name Description
sourceTable Table

The destination table.

Returns
Type Description
CopyJobConfiguration

writeDisposition

Sets the action that occurs if the destination table already exists. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.

Example:

$copyJobConfig->writeDisposition('WRITE_TRUNCATE');
Parameter
Name Description
writeDisposition string

The write disposition. Acceptable values include "WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY". Defaults to* "WRITE_EMPTY".

Returns
Type Description
CopyJobConfiguration