Skip to content

CrosswalkDefinition

CrosswalkDefinition

Bases: BaseDefinition

Create and manage a method to perform a schema to schema crosswalk.

Strategy

Guidance on how to use this definition is in the strategies section on Crosswalk Strategies.

Parameters:

Name Type Description Default
crosswalk CrosswalkModel | dict | Path | str | None

A dictionary conforming to the CrosswalkModel, or a path to a saved definition.

None
schema_source SchemaDefinition | SchemaModel | dict | Path | str | None

Path to a json file containing a saved schema, or a dictionary conforming to one, or a definition.

None
schema_destination SchemaDefinition | SchemaModel | dict | Path | str | None

Path to a json file containing a saved schema, or a dictionary conforming to one, or a definition.

None
Example

Create a new CrosswalkDefinition as follows:

import whyqd as qd

crosswalk = qd.CrosswalkDefinition()
crosswalk.set(schema_source=SCHEMA_SOURCE, schema_destination=SCHEMA_DESTINATION)

actions: CRUDAction property

Returns the active crud model for all Action operations. See Action CRUD for API.

Returns:

Type Description
CRUDAction

For all Action CRUD behaviours.

get: CrosswalkModel | None property

Get the crosswalk model.

Returns:

Type Description
CrosswalkModel | None

A Pydantic CrosswalkModel or None

set(*, crosswalk=None, schema_source=None, schema_destination=None)

Update or create the crosswalk.

Parameters:

Name Type Description Default
crosswalk CrosswalkModel | dict | Path | str | None

A dictionary conforming to the CrosswalkModel, or a path to a saved definition.

None
schema_source SchemaDefinition | SchemaModel | dict | Path | str | None

Path to a json file containing a saved schema, or a dictionary conforming to one, or a definition.

None
schema_destination SchemaDefinition | SchemaModel | dict | Path | str | None

Path to a json file containing a saved schema, or a dictionary conforming to one, or a definition.

None

validate()

Validate that all required fields are returned from the crosswalk.

Raises:

Type Description
ValueError

If required destination fields are not present in the crosswalk.

Returns:

Type Description
bool

A boolean True if successful.