Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 325
feat: Adds ForeignTypeInfo class and tests#2110
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
e909fb33cd984a2e466100ca398dd5ec4b3b324072ef53e2cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -560,6 +560,63 @@ def to_api_repr(self) -> dict: | ||||||||
| return answer | ||||||||
| class ForeignTypeInfo: | ||||||||
| """Metadata about the foreign data type definition such as the system in which the | ||||||||
| type is defined. | ||||||||
| Args: | ||||||||
| type_system (str): Required. Specifies the system which defines the | ||||||||
| foreign data type. | ||||||||
| TypeSystem enum currently includes: | ||||||||
| * "TYPE_SYSTEM_UNSPECIFIED" | ||||||||
| * "HIVE" | ||||||||
| """ | ||||||||
| def __init__(self, type_system: Optional[str] = None): | ||||||||
| self._properties: Dict[str, Any] = {} | ||||||||
| self.type_system = type_system | ||||||||
| @property | ||||||||
| def type_system(self) -> Optional[str]: | ||||||||
| """Required. Specifies the system which defines the foreign data | ||||||||
| type.""" | ||||||||
| return self._properties.get("typeSystem") | ||||||||
| @type_system.setter | ||||||||
| def type_system(self, value: Optional[str]): | ||||||||
| value = _helpers._isinstance_or_raise(value, str, none_allowed=True) | ||||||||
| self._properties["typeSystem"] = value | ||||||||
| def to_api_repr(self) -> dict: | ||||||||
| """Build an API representation of this object. | ||||||||
| Returns: | ||||||||
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.
Suggested change
similar to https://github.com/googleapis/python-bigquery/pull/2110/files#r1914849397 CollaboratorAuthor 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. Resolved. | ||||||||
| Dict[str, Any]: | ||||||||
| A dictionary in the format used by the BigQuery API. | ||||||||
| """ | ||||||||
| return self._properties | ||||||||
| @classmethod | ||||||||
| def from_api_repr(cls, api_repr: Dict[str, Any]) -> "ForeignTypeInfo": | ||||||||
| """Factory: constructs an instance of the class (cls) | ||||||||
| given its API representation. | ||||||||
| Args: | ||||||||
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.
Suggested change
same as https://github.com/googleapis/python-bigquery/pull/2110/files#r1914849397 CollaboratorAuthor 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. Resolved. | ||||||||
| api_repr (Dict[str, Any]): | ||||||||
| API representation of the object to be instantiated. | ||||||||
| Returns: | ||||||||
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.
Suggested change
same as https://github.com/googleapis/python-bigquery/pull/2110/files#r1914849397 CollaboratorAuthor 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. Resolved. | ||||||||
| An instance of the class initialized with data from 'api_repr'. | ||||||||
| """ | ||||||||
| config = cls() | ||||||||
| config._properties = api_repr | ||||||||
| return config | ||||||||
| class SerDeInfo: | ||||||||
| """Serializer and deserializer information. | ||||||||
| @@ -625,6 +682,7 @@ def parameters(self, value: Optional[dict[str, str]] = None): | ||||||||
| def to_api_repr(self) -> dict: | ||||||||
| """Build an API representation of this object. | ||||||||
| Returns: | ||||||||
| Dict[str, Any]: | ||||||||
| A dictionary in the format used by the BigQuery API. | ||||||||
| @@ -635,11 +693,13 @@ def to_api_repr(self) -> dict: | ||||||||
| def from_api_repr(cls, api_repr: dict) -> SerDeInfo: | ||||||||
| """Factory: constructs an instance of the class (cls) | ||||||||
| given its API representation. | ||||||||
| Args: | ||||||||
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.
Suggested change
CollaboratorAuthor 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. Resolved. | ||||||||
| resource (Dict[str, Any]): | ||||||||
| api_repr (Dict[str, Any]): | ||||||||
| API representation of the object to be instantiated. | ||||||||
| Returns: | ||||||||
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.
Suggested change
CollaboratorAuthor 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. Resolved. | ||||||||
| An instance of the class initialized with data from 'resource'. | ||||||||
| An instance of the class initialized with data from 'api_repr'. | ||||||||
| """ | ||||||||
| config = cls("PLACEHOLDER") | ||||||||
| config._properties = api_repr | ||||||||
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.
Nit: needs a blank line to separate the sections
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.
Resolved.