# The column "xxx" in BatchData does not exist for query asset batch request

**URL:** <https://discourse.greatexpectations.io/t/the-column-xxx-in-batchdata-does-not-exist-for-query-asset-batch-request/1589>\
**Category:** GX Core Support\
**Tags:** help-wanted\
**Created:** [January 19, 2024, 2:11am UTC](https://discourse.greatexpectations.io/t/the-column-xxx-in-batchdata-does-not-exist-for-query-asset-batch-request/1589 "2024-01-19T02:11:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya](https://avatars.discourse-cdn.com/v4/letter/f/a9a28c/32.png) [@Freya](https://discourse.greatexpectations.io/u/Freya)\
**Post date:** [January 19, 2024, 2:11am UTC](https://discourse.greatexpectations.io/t/the-column-xxx-in-batchdata-does-not-exist-for-query-asset-batch-request/1589/1 "2024-01-19T02:11:51Z")

</div>

Hi GX community! I am using `0.18.3 ` and query asset to get batch request and do data validation. But there is always error saying “The column “xxx” in BatchData does not exist.”  
When I print validator.head() I could see the column, however once add validate rule e.g. validator.expect\_column\_values\_to\_not\_be\_null(column=“my\_column”) then it will throw out error no such column “The column “my\_column” in BatchData does not exist.” my code is like this:  
`query_name = "select * from my_table"`  
`trino_datasource.add_query_asset(name=asset_name, query=query_name)`  
`my_asset = data_context.get_datasource("trino").get_asset(asset_name) `  
`batch_request = my_asset.build_batch_request() `  
`expectation_suite_name = "test_column_not_null"`  
`data_context.add_or_update_expectation_suite(expectation_suite_name=expectation_suite_name)`  
`validator = data_context.get_validator(batch_request=batch_request, expectation_suite_name=expectation_suite_name) `  
`validator.expect_column_values_to_not_be_null(column="my_column")` (edited)

---

<div class="post-metadata">

**Author:** ![HaebichanGX](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/haebichangx/32/211_2.png) [@HaebichanGX](https://discourse.greatexpectations.io/u/HaebichanGX)\
**Post date:** [January 24, 2024, 3:50pm UTC](https://discourse.greatexpectations.io/t/the-column-xxx-in-batchdata-does-not-exist-for-query-asset-batch-request/1589/2 "2024-01-24T15:50:45Z")

</div>

Hey @Freya just out of curiosity, does `add_table_asset` work? I believe this issue doesn’t occur on this method. And since you’re pulling the whole table anyway.

---

<div class="post-metadata">

**Author:** ![Freya](https://avatars.discourse-cdn.com/v4/letter/f/a9a28c/32.png) [@Freya](https://discourse.greatexpectations.io/u/Freya)\
**Post date:** [January 26, 2024, 3:32am UTC](https://discourse.greatexpectations.io/t/the-column-xxx-in-batchdata-does-not-exist-for-query-asset-batch-request/1589/3 "2024-01-26T03:32:27Z")

</div>

hi @HaebichanGX ，yes “add\_table\_asset” works perfectly. But now we need to do some data filter, so I need to use add\_query\_asset.

---

<div class="post-metadata">

**Author:** ![slack\_user](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/slack_user/32/202_2.png) [@slack\_user](https://discourse.greatexpectations.io/u/slack_user)\
**Post date:** [January 26, 2024, 8:02am UTC](https://discourse.greatexpectations.io/t/the-column-xxx-in-batchdata-does-not-exist-for-query-asset-batch-request/1589/4 "2024-01-26T08:02:38Z")

</div>

or is there any workaround we could filter data?  
Note: `@Wanyun Ding` originally [posted this reply in Slack](https://greatexpectationstalk.slack.com/archives/CUTCNHN82/p1706256147722089?thread_ts=1705630332.288579&cid=CUTCNHN82). It might not have transferred perfectly.
