Repository navigation
add WRITE_TRUNCATE_DATA write_disposition to the bigquery python sdk #40622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2b4ecc5
6f9745d
a5a8a77
d233c0c
c43e2ea
b502882
9335f60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5440,12 +5440,15 @@ class JobConfigurationTableCopy(_messages.Message): | |
| destination table already exists. The following values are supported: * | ||
| WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the | ||
| table data and uses the schema and table constraints from the source | ||
| table. * WRITE_APPEND: If the table already exists, BigQuery appends the | ||
| data to the table. * WRITE_EMPTY: If the table already exists and | ||
| contains data, a 'duplicate' error is returned in the job result. The | ||
| default value is WRITE_EMPTY. 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. | ||
| table. * WRITE_TRUNCATE_DATA: If the table already exists, BigQuery | ||
| overwrites the table data, but does not use schema and table constraints | ||
| from the source table.* WRITE_APPEND: If the table already exists, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium: |
||
| BigQuery appends the data to the table. * WRITE_EMPTY: If the table | ||
| already exists and contains data, a 'duplicate' error is returned in | ||
| the job result. The default value is WRITE_EMPTY. 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. | ||
| """ | ||
|
|
||
| class OperationTypeValueValuesEnum(_messages.Enum): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Critical: Allowing
WRITE_TRUNCATE_DATAhere enables it forBigQueryBatchFileLoads, butsdks/python/apache_beam/io/gcp/bigquery_file_loads.pyonly checks for('WRITE_EMPTY', 'WRITE_TRUNCATE')inBigQueryBatchFileLoads._load_data(line 970) and('WRITE_TRUNCATE', 'WRITE_APPEND')inUpdateDestinationSchema.process(line 368).Without including
'WRITE_TRUNCATE_DATA'inBigQueryBatchFileLoads._load_data, loads that spill into multiple temporary tables will not be grouped by destination beforeTriggerCopyJobs. As a result, parallel copy jobs will each execute withWRITE_TRUNCATE_DATAand overwrite one another's data. Please update both checks inbigquery_file_loads.py.