Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd93986e

Browse files
authored
feat: addExternalConfig.connection_id property to connect to external sources (#560)
* feat: add `ExternalConfig.connection_id` property to connect to external sources* add tests* fix unit tests
1 parent97ee6ec commitd93986e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

‎google/cloud/bigquery/external_config.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,23 @@ def schema(self):
760760
prop=self._properties.get("schema", {})
761761
return [SchemaField.from_api_repr(field)forfieldinprop.get("fields", [])]
762762

763+
@property
764+
defconnection_id(self):
765+
"""Optional[str]: [Experimental] ID of a BigQuery Connection API
766+
resource.
767+
768+
.. WARNING::
769+
770+
This feature is experimental. Pre-GA features may have limited
771+
support, and changes to pre-GA features may not be compatible with
772+
other pre-GA versions.
773+
"""
774+
returnself._properties.get("connectionId")
775+
776+
@connection_id.setter
777+
defconnection_id(self,value):
778+
self._properties["connectionId"]=value
779+
763780
@schema.setter
764781
defschema(self,value):
765782
prop=value

‎tests/unit/test_external_config.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def test_to_api_repr_base(self):
7474
ec.autodetect=True
7575
ec.ignore_unknown_values=False
7676
ec.compression="compression"
77+
ec.connection_id="path/to/connection"
7778
ec.schema= [schema.SchemaField("full_name","STRING",mode="REQUIRED")]
7879

7980
exp_schema= {
@@ -87,10 +88,17 @@ def test_to_api_repr_base(self):
8788
"autodetect":True,
8889
"ignoreUnknownValues":False,
8990
"compression":"compression",
91+
"connectionId":"path/to/connection",
9092
"schema":exp_schema,
9193
}
9294
self.assertEqual(got_resource,exp_resource)
9395

96+
deftest_connection_id(self):
97+
ec=external_config.ExternalConfig("")
98+
self.assertIsNone(ec.connection_id)
99+
ec.connection_id="path/to/connection"
100+
self.assertEqual(ec.connection_id,"path/to/connection")
101+
94102
deftest_schema_None(self):
95103
ec=external_config.ExternalConfig("")
96104
ec.schema=None

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp