Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions airflow/providers/google/cloud/operators/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ class BigQueryCreateExternalTableOperator(BaseOperator):
{"name": "salary", "type": "INTEGER", "mode": "NULLABLE"}]

Should not be set when source_format is 'DATASTORE_BACKUP'.
:param autodetect: (Optional) If True will automatically detect schema of file.
:param table_resource: Table resource as described in documentation:
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table
If provided all other parameters are ignored. External schema from object will be resolved.
Expand Down Expand Up @@ -1024,6 +1025,7 @@ def __init__(
destination_project_dataset_table: Optional[str] = None,
table_resource: Optional[Dict[str, Any]] = None,
schema_fields: Optional[List] = None,
autodetect: bool = True,
schema_object: Optional[str] = None,
source_format: Optional[str] = None,
compression: Optional[str] = None,
Expand Down Expand Up @@ -1051,6 +1053,7 @@ def __init__(
destination_project_dataset_table,
schema_fields,
source_format,
autodetect,
compression,
skip_leading_rows,
field_delimiter,
Expand Down Expand Up @@ -1107,6 +1110,7 @@ def __init__(
if table_resource and kwargs_passed:
raise ValueError("You provided both `table_resource` and exclusive keywords arguments.")

self.autodetect = autodetect
self.max_bad_records = max_bad_records
self.quote_character = quote_character
self.allow_quoted_newlines = allow_quoted_newlines
Expand Down Expand Up @@ -1161,6 +1165,7 @@ def execute(self, context: 'Context') -> None:
src_fmt_configs=self.src_fmt_configs,
labels=self.labels,
encryption_configuration=self.encryption_configuration,
autodetect=self.autodetect,
)


Expand Down
2 changes: 2 additions & 0 deletions tests/providers/google/cloud/operators/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def test_execute(self, mock_hook):
bucket=TEST_GCS_BUCKET,
source_objects=TEST_GCS_DATA,
source_format=TEST_SOURCE_FORMAT,
autodetect = False,
)

operator.execute(None)
Expand All @@ -214,6 +215,7 @@ def test_execute(self, mock_hook):
src_fmt_configs={},
labels=None,
encryption_configuration=None,
autodetect = False,
)


Expand Down