BigQuery Client - Class CopyJobConfiguration (1.27.0)

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

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
NameDescription
createDisposition string

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

Returns
TypeDescription
Google\Cloud\BigQuery\CopyJobConfiguration

destinationEncryptionConfiguration

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

Example:

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

Custom encryption configuration.

Returns
TypeDescription
Google\Cloud\BigQuery\CopyJobConfiguration

destinationTable

Sets the destination table.

Example:

$table = $bigQuery->dataset('my_dataset')
    ->table('my_table');
$copyJobConfig->destinationTable($table);
Parameter
NameDescription
destinationTable Google\Cloud\BigQuery\Table

The destination table.

Returns
TypeDescription
Google\Cloud\BigQuery\CopyJobConfiguration

sourceTable

Sets the source table to copy.

Example:

$table = $bigQuery->dataset('my_dataset')
    ->table('source_table');
$copyJobConfig->sourceTable($table);
Parameter
NameDescription
sourceTable Google\Cloud\BigQuery\Table

The destination table.

Returns
TypeDescription
Google\Cloud\BigQuery\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
NameDescription
writeDisposition string

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

Returns
TypeDescription
Google\Cloud\BigQuery\CopyJobConfiguration