# <img className="page-icon" src="/img/icons/great-expectations.svg" alt="" /> Export: Great Expectations

Transforms a data contract into a comprehensive [Great Expectations](https://greatexpectations.io/) JSON suite. If the contract includes multiple models, specify the model with `--schema-name`.

{/* AUTOGENERATED EXAMPLE: do not edit by hand; regenerate with the update script. */}

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

Running this against the [example `orders` contract](https://github.com/datacontract/datacontract-cli/blob/main/examples/orders/orders.odcs.yaml) produces:

```json
{
  "name": "orders.1.0.0",
  "expectations": [
    {
      "type": "expect_table_columns_to_match_set",
      "description": "orders must contain exactly the contracted columns",
      "kwargs": {
        "column_set": [
          "order_id",
          "order_timestamp",
          "customer_id",
          "order_total",
          "status"
        ]
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.column_set",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "table"
        },
        "name": "orders must contain exactly the contracted columns",
        "dimension": "conformity"
      }
    },
    {
      "type": "expect_column_values_to_be_of_type",
      "description": "order_id must be of type VARCHAR",
      "kwargs": {
        "column": "order_id",
        "type_": "VARCHAR"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_id.order_id_must_be_of_type_varchar",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_id must be of type VARCHAR",
        "dimension": "conformity"
      }
    },
    {
      "type": "expect_column_values_to_not_be_null",
      "description": "order_id is a primary key and must not contain null values",
      "kwargs": {
        "column": "order_id"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_id.order_id_must_be_filled_primary_key",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_id must be filled (primary key)",
        "dimension": "completeness"
      }
    },
    {
      "type": "expect_column_values_to_be_unique",
      "description": "order_id is a primary key and must contain unique values",
      "kwargs": {
        "column": "order_id"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_id.order_id_must_be_unique_primary_key",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_id must be unique (primary key)",
        "dimension": "uniqueness"
      }
    },
    {
      "type": "expect_column_values_to_be_of_type",
      "description": "order_timestamp must be of type TIMESTAMP",
      "kwargs": {
        "column": "order_timestamp",
        "type_": "TIMESTAMP"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_timestamp.order_timestamp_must_be_of_type_timestamp",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_timestamp must be of type TIMESTAMP",
        "dimension": "conformity"
      }
    },
    {
      "type": "expect_column_values_to_not_be_null",
      "description": "order_timestamp must be not null values",
      "kwargs": {
        "column": "order_timestamp"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_timestamp.order_timestamp_must_be_filled",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_timestamp must be filled",
        "dimension": "completeness"
      }
    },
    {
      "type": "expect_column_values_to_be_of_type",
      "description": "customer_id must be of type VARCHAR",
      "kwargs": {
        "column": "customer_id",
        "type_": "VARCHAR"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.customer_id.customer_id_must_be_of_type_varchar",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "customer_id must be of type VARCHAR",
        "dimension": "conformity"
      }
    },
    {
      "type": "expect_column_values_to_not_be_null",
      "description": "customer_id must be not null values",
      "kwargs": {
        "column": "customer_id"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.customer_id.customer_id_must_be_filled",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "customer_id must be filled",
        "dimension": "completeness"
      }
    },
    {
      "type": "expect_column_values_to_be_of_type",
      "description": "order_total must be of type INTEGER",
      "kwargs": {
        "column": "order_total",
        "type_": "INTEGER"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_total.order_total_must_be_of_type_integer",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_total must be of type INTEGER",
        "dimension": "conformity"
      }
    },
    {
      "type": "expect_column_values_to_not_be_null",
      "description": "order_total must be not null values",
      "kwargs": {
        "column": "order_total"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.order_total.order_total_must_be_filled",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "order_total must be filled",
        "dimension": "completeness"
      }
    },
    {
      "type": "expect_column_values_to_be_of_type",
      "description": "status must be of type VARCHAR",
      "kwargs": {
        "column": "status",
        "type_": "VARCHAR"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.status.status_must_be_of_type_varchar",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "status must be of type VARCHAR",
        "dimension": "conformity"
      }
    },
    {
      "type": "expect_column_values_to_not_be_null",
      "description": "status must be not null values",
      "kwargs": {
        "column": "status"
      },
      "meta": {
        "expectation_id": "urn:datacontract:checkout:orders.status.status_must_be_filled",
        "data_contract_rule_location": {
          "origin": "schema_inferred",
          "scope": "column"
        },
        "name": "status must be filled",
        "dimension": "completeness"
      }
    }
  ],
  "meta": {
    "contract_id": "urn:datacontract:checkout:orders",
    "contract_version": "1.0.0"
  }
}
```

{/* END AUTOGENERATED EXAMPLE */}

The export builds expectations from the model definition (with a fixed mapping) and from the `quality` rules of each model (see the [expectations gallery](https://greatexpectations.io/expectations/)).

## 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).
- `--dialect` — the SQL dialect when `--engine` is `sql`. `auto` (default) detects it from the contract's servers.
- `--checks` — comma-separated list of check categories to export: `properties` (constraints inferred from logical types) and/or `quality` (rules from the contract's `quality` blocks). Omit to export both.

All options: **[`datacontract export great-expectations`](../commands/export/great-expectations.md)**.
