# How to apply suite on GX OSS?

**URL:** <https://discourse.greatexpectations.io/t/how-to-apply-suite-on-gx-oss/1681>\
**Category:** GX Core Support\
**Tags:** how-to\
**Created:** [March 26, 2024, 7:15am UTC](https://discourse.greatexpectations.io/t/how-to-apply-suite-on-gx-oss/1681 "2024-03-26T07:15:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hwan](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@Hwan](https://discourse.greatexpectations.io/u/Hwan)\
**Post date:** [March 26, 2024, 7:15am UTC](https://discourse.greatexpectations.io/t/how-to-apply-suite-on-gx-oss/1681/1 "2024-03-26T07:15:11Z")

</div>

I’m currently working on a POC for the GX OSS. I want to have the following behavior. After reading the file `yellow_tripdata_sample_2019-01.csv`, I create an expectation to inspect that file. After that, I hope to be able to view the report as html.  
But when I write the code below and run it, I get a result of 0. The result I expect is failure. I guess the suite is not applied, but I don’t know how to apply it.

```auto
from great_expectations.core.expectation_configuration import (
    ExpectationConfiguration,
)
import great_expectations as gx

context = gx.get_context()

validator = context.sources.pandas_default.read_csv(
    "./yellow_tripdata_sample_2019-01.csv"
)

suite = context.add_or_update_expectation_suite(expectation_suite_name="checkpoint1")

expectation_configuration = ExpectationConfiguration(
    # Name of expectation type being added
    expectation_type="expect_table_columns_to_match_ordered_list",
    # These are the arguments of the expectation
    # The keys allowed in the dictionary are Parameters and
    # Keyword Arguments of this Expectation Type
    kwargs={
        "column_list": [
            "account_id",
            "user_id",
            "transaction_id",
            "transaction_type",
            "transaction_amt_usd",
        ]
    },
    # This is how you can optionally add a comment about this expectation.
    # It will be rendered in Data Docs.
    # See this guide for details:
    # `How to add comments to Expectations and display them in Data Docs`.
    meta={
        "notes": {
            "format": "markdown",
            "content": "Some clever comment about this expectation. **Markdown** `Supported`",
        }
    },
)

suite.add_expectation(expectation_configuration=expectation_configuration)

context.save_expectation_suite(expectation_suite=suite)

context.run_checkpoint(checkpoint_name="checkpoint1", validator=validator)

```

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/greatexpectations/original/1X/862e6dd25adbfd8679b3d876781ac9f6b59406e4.png)

---

<div class="post-metadata">

**Author:** ![ToivoMattila](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/toivomattila/32/254_2.png) [@ToivoMattila](https://discourse.greatexpectations.io/u/ToivoMattila)\
**Post date:** [April 3, 2024, 4:21pm UTC](https://discourse.greatexpectations.io/t/how-to-apply-suite-on-gx-oss/1681/2 "2024-04-03T16:21:22Z")

</div>

Hi and welcome!

Try if this code works  
There is an explanation after the code

```auto
import great_expectations as gx

context = gx.get_context()

validator = context.sources.pandas_default.read_csv(
    "https://raw.githubusercontent.com/great-expectations/gx_tutorials/main/data/yellow_tripdata_sample_2019-01.csv"
)

validation_result = validator.expect_table_columns_to_match_ordered_list(column_list=[
            "account_id",
            "user_id",
            "transaction_id",
            "transaction_type",
            "transaction_amt_usd",
        ]
)
if validation_result["success"] is False:
    print("Validation failed!")

for col in validator.head().columns:
    validator.expect_column_values_to_not_be_null(col)

validator.save_expectation_suite(discard_failed_expectations=False)

checkpoint = context.add_or_update_checkpoint(name="checkpoint1", validator=validator)

result = checkpoint.run()

print(result)

```

Alright, here are some notes about the code and how I changed it.

I changed creating the Expectations to use the `validator` instead of the `ExpectationConfiguration` syntax. Then I added a line that creates a new Checkpoint from that `validator`. The `validator` includes information about what data to validate as well as what Expectation to validate it with.

Note that there is a line that saves the validator. By default, the validator would discard any failed validations but I specified it to also save the failed validations. I also added some other checks so that your PoC report has both failing and succeeding validations.

Also, I copied the code you provided but got an error, not an empty report. Did you get the empty report by running this exact code?
