fixup! Add ability to set autodetect_schema query_param · googleapis/python-bigquery@b329cd0 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit b329cd0

Browse files
committed
fixup! Add ability to set autodetect_schema query_param
1 parent 12bb7a8 commit b329cd0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tests/system/test_client.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,8 @@ def test_update_table_autodetect_schema(self):
985985
TABLE_NAME = "test_table"
986986
set_schema = [bigquery.SchemaField("username", "STRING", mode="NULLABLE")]
987987
table_arg = Table(dataset.table(TABLE_NAME))
988+
989+
# Create an external_config and include it in the table arguments
988990
external_config = bigquery.ExternalConfig(bigquery.ExternalSourceFormat.AVRO)
989991
external_config.source_uris = SOURCE_URIS_AVRO
990992
external_config.reference_file_schema_uri = REFERENCE_FILE_SCHEMA_URI_AVRO
@@ -1001,22 +1003,19 @@ def test_update_table_autodetect_schema(self):
10011003

10021004
# Update table with schema autodetection
10031005
updated_table_arg = Table(dataset.table(TABLE_NAME))
1004-
updated_external_config = bigquery.ExternalConfig(
1005-
bigquery.ExternalSourceFormat.AVRO
1006-
)
1007-
updated_external_config.source_uris = SOURCE_URIS_AVRO
1008-
updated_external_config.reference_file_schema_uri = (
1009-
REFERENCE_FILE_SCHEMA_URI_AVRO
1010-
)
1006+
1007+
# Update the external_config and include it in the table arguments
1008+
updated_external_config = copy.deepcopy(external_config)
10111009
updated_external_config.autodetect = True
10121010
updated_external_config.schema = None
10131011
updated_table_arg.external_data_configuration = updated_external_config
10141012

1013+
# PATCH call with autodetect_schema=True to trigger schema inference
10151014
updated_table = Config.CLIENT.update_table(
10161015
updated_table_arg, ["external_data_configuration"], autodetect_schema=True
10171016
)
10181017

1019-
# The updated table shlould have a schema inferred from the reference
1018+
# The updated table should have a schema inferred from the reference
10201019
# file, which has all four fields.
10211020
expected_schema = [
10221021
bigquery.SchemaField("username", "STRING", mode="NULLABLE"),

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.