# Error with dbt macro postgres\_\_api\_gateway\_method\_settings in foundational\_security\_free policy

**URL:** <https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440>\
**Category:** CloudQuery Plugins\
**Created:** [January 20, 2024, 4:12pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440 "2024-01-20T16:12:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![handy-bee](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@handy-bee](https://community.cloudquery.io/u/handy-bee)\
**Post date:** [January 20, 2024, 4:12pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/1 "2024-01-20T16:12:44Z")

</div>

Morning – I’m poking around in the `foundational_security_free` policy right now and getting an error when I run the `postgres__api_gateway_method_settings` macro through dbt. Can’t find it on GitHub.

```auto
error: more than one row returned by a subquery used as an expression

```

This comes from stages with multiple entries in the `method_settings` column of `aws_apigateway_rest_apis`, which is strange since the `JSONB_TEXT_EACH` function should just be able to handle that?

---

<div class="post-metadata">

**Author:** ![yevgenyp](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@yevgenyp](https://community.cloudquery.io/u/yevgenyp)\
**Post date:** [January 20, 2024, 4:22pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/2 "2024-01-20T16:22:57Z")

</div>

Hey! Thanks for reporting this. I’m looping in Jonathan, one of our data analysts, to take a look at this tomorrow when he is back.

---

<div class="post-metadata">

**Author:** ![handy-bee](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@handy-bee](https://community.cloudquery.io/u/handy-bee)\
**Post date:** [January 20, 2024, 4:25pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/3 "2024-01-20T16:25:46Z")

</div>

aws plugin v22.8.2 but the tables (or at least this column) look the same from what I can tell  
aurora postgres 13.8  
can’t extract the example data from the corp network but this is what the rows look like from an extracted example record:

```auto
(*/*, {"LoggingLevel":null, "CachingEnabled":false ...})
(~1/POST, {"LoggingLevel":"OFF", "CachingEnabled":false ...})

```

---

<div class="post-metadata">

**Author:** ![jonathan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.cloudquery.io/jonathan/32/29_2.png) [@jonathan](https://community.cloudquery.io/u/jonathan)\
**Post date:** [January 22, 2024, 11:16am UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/4 "2024-01-22T11:16:40Z")

</div>

Hi @handy-bee!

Thanks for pointing that out (and suggesting a solution). We’ve just released version 1.0.1 for the AWS Compliance (Free) addon, which includes the fix to the `postgres__api_gateway_method_settings` macro.

You can find the details here: [AWS Compliance (Free) v1.0.1 Docs](https://hub.cloudquery.io/addons/transformation/cloudquery/aws-compliance-free/v1.0.1/docs).

Could you give it a spin and let us know if it’s all good now?

---

<div class="post-metadata">

**Author:** ![handy-bee](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@handy-bee](https://community.cloudquery.io/u/handy-bee)\
**Post date:** [January 22, 2024, 12:59pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/5 "2024-01-22T12:59:41Z")

</div>

Sure, I’ll let you know shortly.  
Works!

There are some CloudTrail mismatches I think between the new versions of the provider and our v22 version causing some issues. In the `postgres__log_metric_filter_and_alarm()` macro, `advanced_event_selectors` changed types in the version change, I think.

How should we treat those? Ideally, the policies would be versioned with the providers, but I realize that makes a lot of work for the same thing.

---

<div class="post-metadata">

**Author:** ![ben](https://sea1.discourse-cdn.com/flex001/user_avatar/community.cloudquery.io/ben/32/88_2.png) [@ben](https://community.cloudquery.io/u/ben)\
**Post date:** [January 22, 2024, 5:02pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/6 "2024-01-22T17:02:58Z")

</div>

@handy-bee - Between V22 and V23 of the AWS plugin, we changed the schema of that table to ensure that all data was being persisted in the database. As such, we had to change the macro, but our policies are only designed to be compatible with specific versions of the plugin. We have an open issue to expose that compatibility via the hub.

The `aws-compliance-free` version `v1.0.1` is designed and tested to be compatible with `v23.3.1` of the AWS plugin. We know that staying up to date with the plugin version can be difficult at times, but know that work is currently underway to eliminate much of that work by ensuring that changes to primary keys will not break schemas.

---

<div class="post-metadata">

**Author:** ![handy-bee](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@handy-bee](https://community.cloudquery.io/u/handy-bee)\
**Post date:** [January 22, 2024, 6:51pm UTC](https://community.cloudquery.io/t/error-with-dbt-macro-postgres-api-gateway-method-settings-in-foundational-security-free-policy/440/7 "2024-01-22T18:51:43Z")

</div>

Makes total sense. Also, “shiny new features” is a great way to drive adoption of the new versions of software. We use that technique internally all the time, so I get that approach too.
