Resource
General and abstract implementation for a resource.
A resource defines the data model that is used by a resource container (model.container.resourceContainer
).
Resource
¶
Bases: ABC
, BasicModel
General and abstract implementation for a resource.
A resource defines the data model used by a resource container (model.container.resourceContainer
).
It inherits from Pydantic's BaseModel to get all its superpowers,
which are used to parse, validate the API response and to easily switch between
the Python representation (both serialized and deserialized) and Java representation (serialized only).
Config
¶
Configuration class for Pydantic. Defines alias generator to convert field names from camelCase (API) to snake_case (Python codebase).
convert_to_pandas_representation()
abstractmethod
¶
Returns a dictionary representation to be used when creating a pandas Dataframe.
RETURNS | DESCRIPTION |
---|---|
pandas_repr
|
Pandas representation of the resource as a dictionary, which is then used by the respource container to create a data frame from a collection of resources.
TYPE:
|
to_dict(use_source_names=True)
¶
Returns the resource in dictionary representation.
PARAMETER | DESCRIPTION |
---|---|
use_source_names |
Indicates if the dictionary keys are in python representation or equally named to the StreamPipes backend
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
resource
|
The resource as dictionary representation
TYPE:
|