Skip to content

feat: add ability to set autodetect_schema query param in update_table #2171

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

Merged
merged 6 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixup! Add ability to set autodetect_schema query_param
  • Loading branch information
TheNeuralBit committed May 7, 2025
commit 9d12d803da1523153c0ad7b6c84acdfa1d2107d4
2 changes: 1 addition & 1 deletion google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ def update_table(
if autodetect_schema:
query_params = {"autodetect_schema": True}
else:
query_params = None
query_params = {}

api_response = self._call_api(
retry,
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@ def test_update_table(self):
"resourceTags": {"123456789012/key": "value"},
}
conn.api_request.assert_called_once_with(
method="PATCH", data=sent, path="/" + path, timeout=7.5
method="PATCH", data=sent, path="/" + path, timeout=7.5, query_params={}
)
self.assertEqual(updated_table.description, table.description)
self.assertEqual(updated_table.friendly_name, table.friendly_name)
Expand Down Expand Up @@ -2439,6 +2439,7 @@ def test_update_table_w_custom_property(self):
path="/%s" % path,
data={"newAlphaProperty": "unreleased property"},
timeout=DEFAULT_TIMEOUT,
query_params={},
)
self.assertEqual(
updated_table._properties["newAlphaProperty"], "unreleased property"
Expand Down Expand Up @@ -2475,6 +2476,7 @@ def test_update_table_only_use_legacy_sql(self):
path="/%s" % path,
data={"view": {"useLegacySql": True}},
timeout=DEFAULT_TIMEOUT,
query_params={},
)
self.assertEqual(updated_table.view_use_legacy_sql, table.view_use_legacy_sql)

Expand Down Expand Up @@ -2567,6 +2569,7 @@ def test_update_table_w_query(self):
"schema": schema_resource,
},
timeout=DEFAULT_TIMEOUT,
query_params={},
)

def test_update_table_w_schema_None(self):
Expand Down