Skip to content

Query result

QueryResult

Bases: Resource

Implementation of a resource for query result. This resource defines the data model used by its resource container(model.container.DataLakeMeasures). 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()

Returns the dictionary representation of a data lake series to be used when creating a pandas Dataframe.

It contains only the "header rows" (the column names) and "rows" that contain the actual data.

RETURNS DESCRIPTION
dict

Dictionary with the keys headers and rows

RAISES DESCRIPTION
StreamPipesUnsupportedDataLakeSeries

If the query result returned by the StreamPipes API cannot be converted to the pandas representation

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: True

RETURNS DESCRIPTION
resource

The resource as dictionary representation

TYPE: Dict[str, Any]

to_pandas()

Returns the data lake series in representation of a Pandas Dataframe.

RETURNS DESCRIPTION
df

Pandas df containing the query result

TYPE: DataFrame


Last update: December 7, 2024