Checks if the create disposition for the job is CREATE_IF_NEEDED,
which provides the following behavior: If the table does not exist,
the copy operation creates the table. This is the default create
disposition for copy jobs.
Returns
(Boolean) — true when CREATE_IF_NEEDED, false otherwise.
#create_never?
defcreate_never?()->Boolean
Checks if the create disposition for the job is CREATE_NEVER, which
provides the following behavior: The table must already exist; if it
does not, an error is returned in the job result.
Returns
(Boolean) — true when CREATE_NEVER, false otherwise.
#destination
defdestination(view:nil)->Table
The table to which data is copied.
Parameter
view (String) (defaults to: nil) — Specifies the view that determines which table information is returned.
By default, basic table information and storage statistics (STORAGE_STATS) are returned.
Accepted values include :unspecified, :basic, :storage, and
:full. For more information, see BigQuery Classes.
The default value is the :unspecified view type.
The table from which data is copied. This is the table on
which Table#copy_job was called.
Parameter
view (String) (defaults to: nil) — Specifies the view that determines which table information is returned.
By default, basic table information and storage statistics (STORAGE_STATS) are returned.
Accepted values include :unspecified, :basic, :storage, and
:full. For more information, see BigQuery Classes.
The default value is the :unspecified view type.
Checks if the write disposition for the job is WRITE_APPEND, which
provides the following behavior: If the table already exists, the copy
operation appends the data to the table.
Returns
(Boolean) — true when WRITE_APPEND, false otherwise.
#write_empty?
defwrite_empty?()->Boolean
Checks if the write disposition for the job is WRITE_EMPTY, which
provides the following behavior: If the table already exists and
contains data, the job will have an error. This is the default write
disposition for copy jobs.
Returns
(Boolean) — true when WRITE_EMPTY, false otherwise.
#write_truncate?
defwrite_truncate?()->Boolean
Checks if the write disposition for the job is WRITE_TRUNCATE, which
provides the following behavior: If the table already exists, the copy
operation overwrites the table data.
Returns
(Boolean) — true when WRITE_TRUNCATE, false otherwise.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# BigQuery API - Class Google::Cloud::Bigquery::CopyJob (v1.55.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.55.0 (latest)](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-CopyJob)\n- [1.54.0](/ruby/docs/reference/google-cloud-bigquery/1.54.0/Google-Cloud-Bigquery-CopyJob)\n- [1.53.0](/ruby/docs/reference/google-cloud-bigquery/1.53.0/Google-Cloud-Bigquery-CopyJob)\n- [1.52.1](/ruby/docs/reference/google-cloud-bigquery/1.52.1/Google-Cloud-Bigquery-CopyJob)\n- [1.51.1](/ruby/docs/reference/google-cloud-bigquery/1.51.1/Google-Cloud-Bigquery-CopyJob)\n- [1.50.0](/ruby/docs/reference/google-cloud-bigquery/1.50.0/Google-Cloud-Bigquery-CopyJob)\n- [1.49.1](/ruby/docs/reference/google-cloud-bigquery/1.49.1/Google-Cloud-Bigquery-CopyJob)\n- [1.48.1](/ruby/docs/reference/google-cloud-bigquery/1.48.1/Google-Cloud-Bigquery-CopyJob)\n- [1.47.0](/ruby/docs/reference/google-cloud-bigquery/1.47.0/Google-Cloud-Bigquery-CopyJob)\n- [1.46.1](/ruby/docs/reference/google-cloud-bigquery/1.46.1/Google-Cloud-Bigquery-CopyJob)\n- [1.45.0](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-CopyJob)\n- [1.44.2](/ruby/docs/reference/google-cloud-bigquery/1.44.2/Google-Cloud-Bigquery-CopyJob)\n- [1.43.1](/ruby/docs/reference/google-cloud-bigquery/1.43.1/Google-Cloud-Bigquery-CopyJob)\n- [1.42.0](/ruby/docs/reference/google-cloud-bigquery/1.42.0/Google-Cloud-Bigquery-CopyJob)\n- [1.41.0](/ruby/docs/reference/google-cloud-bigquery/1.41.0/Google-Cloud-Bigquery-CopyJob)\n- [1.40.0](/ruby/docs/reference/google-cloud-bigquery/1.40.0/Google-Cloud-Bigquery-CopyJob)\n- [1.39.0](/ruby/docs/reference/google-cloud-bigquery/1.39.0/Google-Cloud-Bigquery-CopyJob)\n- [1.38.1](/ruby/docs/reference/google-cloud-bigquery/1.38.1/Google-Cloud-Bigquery-CopyJob) \nReference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::CopyJob.\n\nCopyJob\n-------\n\nA [Job](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Job \"Google::Cloud::Bigquery::Job (class)\") subclass representing a copy operation that may be performed on\na [Table](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Table \"Google::Cloud::Bigquery::Table (class)\"). A CopyJob instance is created when you call [Table#copy_job](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Table#Google__Cloud__Bigquery__Table_copy_job_instance_ \"Google::Cloud::Bigquery::Table#copy_job (method)\"). \n\nInherits\n--------\n\n- [Google::Cloud::Bigquery::Job](./Google-Cloud-Bigquery-Job)\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nbigquery = Google::Cloud::Bigquery.new\ndataset = bigquery.dataset \"my_dataset\"\ntable = dataset.table \"my_table\"\ndestination_table = dataset.table \"my_destination_table\"\n\ncopy_job = table.copy_job destination_table\n\ncopy_job.wait_until_done!\ncopy_job.done? #=\u003e true\n```\n\nMethods\n-------\n\n### #create_if_needed?\n\n def create_if_needed?() -\u003e Boolean\n\nChecks if the create disposition for the job is `CREATE_IF_NEEDED`,\nwhich provides the following behavior: If the table does not exist,\nthe copy operation creates the table. This is the default create\ndisposition for copy jobs. \n**Returns**\n\n- (Boolean) --- `true` when `CREATE_IF_NEEDED`, `false` otherwise.\n\n### #create_never?\n\n def create_never?() -\u003e Boolean\n\nChecks if the create disposition for the job is `CREATE_NEVER`, which\nprovides the following behavior: The table must already exist; if it\ndoes not, an error is returned in the job result. \n**Returns**\n\n- (Boolean) --- `true` when `CREATE_NEVER`, `false` otherwise.\n\n### #destination\n\n def destination(view: nil) -\u003e Table\n\nThe table to which data is copied. \n**Parameter**\n\n- **view** (String) *(defaults to: nil)* --- Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Accepted values include `:unspecified`, `:basic`, `:storage`, and `:full`. For more information, see [BigQuery Classes](about:invalid#zCSafez). The default value is the `:unspecified` view type. \n**Returns**\n\n- ([Table](./Google-Cloud-Bigquery-Table)) --- A table instance.\n\n### #encryption\n\n def encryption() -\u003e Google::Cloud::BigQuery::EncryptionConfiguration\n\nThe encryption configuration of the destination table. \n**Returns**\n\n- (Google::Cloud::BigQuery::EncryptionConfiguration) --- Custom encryption configuration (e.g., Cloud KMS keys).\n\n### #source\n\n def source(view: nil) -\u003e Table\n\nThe table from which data is copied. This is the table on\nwhich [Table#copy_job](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Table#Google__Cloud__Bigquery__Table_copy_job_instance_ \"Google::Cloud::Bigquery::Table#copy_job (method)\") was called. \n**Parameter**\n\n- **view** (String) *(defaults to: nil)* --- Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Accepted values include `:unspecified`, `:basic`, `:storage`, and `:full`. For more information, see [BigQuery Classes](about:invalid#zCSafez). The default value is the `:unspecified` view type. \n**Returns**\n\n- ([Table](./Google-Cloud-Bigquery-Table)) --- A table instance.\n\n### #write_append?\n\n def write_append?() -\u003e Boolean\n\nChecks if the write disposition for the job is `WRITE_APPEND`, which\nprovides the following behavior: If the table already exists, the copy\noperation appends the data to the table. \n**Returns**\n\n- (Boolean) --- `true` when `WRITE_APPEND`, `false` otherwise.\n\n### #write_empty?\n\n def write_empty?() -\u003e Boolean\n\nChecks if the write disposition for the job is `WRITE_EMPTY`, which\nprovides the following behavior: If the table already exists and\ncontains data, the job will have an error. This is the default write\ndisposition for copy jobs. \n**Returns**\n\n- (Boolean) --- `true` when `WRITE_EMPTY`, `false` otherwise.\n\n### #write_truncate?\n\n def write_truncate?() -\u003e Boolean\n\nChecks if the write disposition for the job is `WRITE_TRUNCATE`, which\nprovides the following behavior: If the table already exists, the copy\noperation overwrites the table data. \n**Returns**\n\n- (Boolean) --- `true` when `WRITE_TRUNCATE`, `false` otherwise."]]