-
Notifications
You must be signed in to change notification settings - Fork 313
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
feat: Adds ForeignTypeInfo class and tests #2110
Changes from all commits
e909fb3
3cd984a
2e46610
0ca398d
d5ec4b3
b324072
ef53e2c
File filter
Filter by extension
Conversations
Jump to
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: | ||||||||
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 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: | ||||||||
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 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: | ||||||||
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 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: | ||||||||
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
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: | ||||||||
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
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.