Nova Resources#

Resource#

class nova.resource.base.Resource(**extra_data: Any)#
Show-inheritance:

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'ignored_types': (<class 'nova.resource.base.Pivot'>, <class 'nova.resource.base._Mount'>, <class 'nova.resource.base._Pivot'>)}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

async classmethod create(data: dict[str, Any], /) Self#
async classmethod create(data: List[dict[str, Any]], /) List[Self]

Creates a resource or a list of resources from the given data.

The data is expected to be a dictionary or a list of dictionaries. Each dictionary should contain a key corresponding to the resource pivot field name. Optionally, the dictionary may provide data for each declared subresource.

A subresource dictionary may have the form:

{
    '$resource': { ... }, # The Node payload or the Resource payload
    '$edge': { ... },     # The payload for the link
}

or simpler form:

{
    ... # The Node payload or the Resource payload
}

If the simpler form is used, the edge data will be instantiated with the default values. If it cannot be instantiated, the simpler form cannot be used and will lead to an error.

Learn more about the subresource data format in the Creating Resources

Parameters:

data – A dictionary or a list of dictionaries containing the data to create the resource(s) with.

ResourceEdge#

class nova.resource.base.ResourceEdge(**data: Any)#

Bases: BaseModel, Generic[T_Mount, T_Mount_EdgeModel]

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].