Skip to main content

Export: Great Expectations

Transforms a data contract into a comprehensive Great Expectations JSON suite. If the contract includes multiple models, specify the model with --schema-name.

datacontract export great-expectations orders.odcs.yaml --schema-name orders

Running this against the example orders contract produces:

{
"name": "orders.1.0.0",
"expectations": [
{
"type": "expect_table_columns_to_match_ordered_list",
"kwargs": {
"column_list": [
"order_id",
"order_timestamp",
"customer_id",
"order_total",
"status"
]
},
"meta": {}
},
{
"type": "expect_column_values_to_be_of_type",
"kwargs": {
"column": "order_id",
"type_": "VARCHAR"
},
"meta": {}
},
{
"type": "expect_column_values_to_be_unique",
"kwargs": {
"column": "order_id"
},
"meta": {}
},
{
"type": "expect_column_values_to_be_of_type",
"kwargs": {
"column": "order_timestamp",
"type_": "TIMESTAMP"
},
"meta": {}
},
{
"type": "expect_column_values_to_be_of_type",
"kwargs": {
"column": "customer_id",
"type_": "VARCHAR"
},
"meta": {}
},
{
"type": "expect_column_values_to_be_of_type",
"kwargs": {
"column": "order_total",
"type_": "NUMBER"
},
"meta": {}
},
{
"type": "expect_column_values_to_be_of_type",
"kwargs": {
"column": "status",
"type_": "VARCHAR"
},
"meta": {}
}
],
"meta": {}
}

The export builds expectations from the model definition (with a fixed mapping) and from the quality rules of each model (see the expectations gallery).

Additional options

  • suite_name — the name of the expectation suite. Defaults to a name derived from the model name(s).
  • engine — the execution engine: pandas (in-memory dataframes), spark (Spark dataframes), or sql (SQL databases).
  • sql_server_type — the SQL server type to connect with when engine is sql. Ensures the correct SQL dialect and connection settings are applied.