# mayim.base.hydrator

# Table of Contents

# Hydrator

class Hydrator()

[view_source] (opens new window)

Object responsible for casting from the data layer to a model

# fallback: Type[object]

The model type that will be used if there is none passed in the hydrate method

Default: dict

# hydrate

def hydrate(data: Dict[str, Any], model: Type[object] = Parameter.empty)

[view_source] (opens new window)

Perform casting operation

Arguments:

  • data Dict[str, Any] - Raw data from the source
  • model Type[object], optional - The model that will do the casting. If no value is passed, it will use whatever the Hydrator's fallback value is set to. Defaults to Parameter.empty.

Returns:

  • _type_ - The data cast into the model