# 'ExpectationSuite' object has no attribute 'add\_expectation\_configuration'

**URL:** <https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696>\
**Category:** GX Core Support\
**Created:** [April 9, 2024, 3:51pm UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696 "2024-04-09T15:51:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_f50](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/mike_f50/32/169_2.png) [@mike\_f50](https://discourse.greatexpectations.io/u/mike_f50)\
**Post date:** [April 9, 2024, 3:51pm UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696/1 "2024-04-09T15:51:06Z")

</div>

What am I doing wrong?

```py
import great_expectations as gx
from great_expectations.core.expectation_configuration import ExpectationConfiguration

context = gx.get_context()

suite = context.add_expectation_suite(expectation_suite_name="my_suite")

config1=ExpectationConfiguration(
    expectation_type="expect_table_row_count_to_be_between",
    kwargs={
        "min_value":0,
        "max_value":100,
    },
)

suite.add_expectation_configuration(expectation_configuration=config1)

```

**Error:**

```auto
AttributeError: 'ExpectationSuite' object has no attribute 'add_expectation_configuration'

```

I belive I’ve followed the instructions [here](https://docs.greatexpectations.io/docs/oss/guides/expectations/how_to_create_and_edit_expectations_based_on_domain_knowledge_without_inspecting_data_directly) pretty closely.

---

<div class="post-metadata">

**Author:** ![mike\_f50](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/mike_f50/32/169_2.png) [@mike\_f50](https://discourse.greatexpectations.io/u/mike_f50)\
**Post date:** [April 9, 2024, 3:56pm UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696/2 "2024-04-09T15:56:19Z")

</div>

**Update:** The code below seems to work.

```py
suite.expectations.append(config1)

```

Perhaps the documentation needs updating?

---

<div class="post-metadata">

**Author:** ![Huhta](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/huhta/32/253_2.png) [@Huhta](https://discourse.greatexpectations.io/u/Huhta)\
**Post date:** [April 10, 2024, 11:24am UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696/3 "2024-04-10T11:24:02Z")

</div>

The code should be

```auto
suite.add_expectation()

```

All the code blocks seem to use the wrong function but the actual text in some docs talk about the above command.

---

<div class="post-metadata">

**Author:** ![ziero](https://avatars.discourse-cdn.com/v4/letter/z/f19dbf/32.png) [@ziero](https://discourse.greatexpectations.io/u/ziero)\
**Post date:** [April 10, 2024, 9:52pm UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696/4 "2024-04-10T21:52:40Z")

</div>

@nevintan have seen this as well – are docs out of date with api?

---

<div class="post-metadata">

**Author:** ![mike\_f50](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/mike_f50/32/169_2.png) [@mike\_f50](https://discourse.greatexpectations.io/u/mike_f50)\
**Post date:** [April 11, 2024, 10:37am UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696/5 "2024-04-11T10:37:07Z")

</div>

Just to note, `suite.add_expectation()` and `suite.expectations.append()` sometimes behave differently when adding the same expectation type more than once. `suite.add_expectation()` will attempt to de-dupe, replacing existing expectations, whereas `suite.expectations.append()` simply appends.

Examples here:

> [@Similar expecations overwriting one another](https://discourse.greatexpectations.io/t/similar-expecations-overwriting-one-another/1695):
>
> I am building an expectation suite in python, and am coming across a few different scenarios where adding another expectation of the same type seems to overwrite an existing one. Example 1: expect\_column\_values\_to\_be\_in\_set (different value\_sets for same column) cohorts = ["Cohort1","Cohort2","Cohort3"] validator.expect\_column\_values\_to\_be\_in\_set( "Cohort", value\_set=cohorts, meta={ "profiler\_details": { "metric\_configuration": { "metric\_name": "cohort\_in\_approved\_set" } } } ) val…

---

<div class="post-metadata">

**Author:** ![nevintan](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/nevintan/32/272_2.png) [@nevintan](https://discourse.greatexpectations.io/u/nevintan)\
**Post date:** [April 11, 2024, 2:01pm UTC](https://discourse.greatexpectations.io/t/expectationsuite-object-has-no-attribute-add-expectation-configuration/1696/6 "2024-04-11T14:01:44Z")

</div>

Hi all! Thank you for flagging this. I’ll notify our docs team to make sure everything is correct and up to date on our side.
