# Issue while running Great expectation validations on Big Query External Tables

**URL:** <https://discourse.greatexpectations.io/t/issue-while-running-great-expectation-validations-on-big-query-external-tables/1734>\
**Category:** GX Core Support\
**Created:** [May 16, 2024, 9:36am UTC](https://discourse.greatexpectations.io/t/issue-while-running-great-expectation-validations-on-big-query-external-tables/1734 "2024-05-16T09:36:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dolly](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@dolly](https://discourse.greatexpectations.io/u/dolly)\
**Post date:** [May 16, 2024, 9:36am UTC](https://discourse.greatexpectations.io/t/issue-while-running-great-expectation-validations-on-big-query-external-tables/1734/1 "2024-05-16T09:36:33Z")

</div>

great-expectations version == 0.18.9  
Environment = Running on a Linux VM

**Issue** : The following expectations are passing the validation even though as per the data it should have some unexpected counts.  
expect\_column\_values\_to\_be\_in\_set  
expect\_column\_values\_to\_be\_between  
expect\_column\_value\_lengths\_to\_equal  
expect\_column\_value\_lengths\_to\_be\_between  
expect\_select\_column\_values\_to\_be\_unique\_within\_record  
expect\_column\_pair\_values\_to\_be\_equal  
expect\_column\_pair\_values\_a\_to\_be\_greater\_than\_b  
expect\_column\_values\_to\_not\_be\_null  
expect\_column\_values\_to\_be\_null  
expect\_column\_values\_to\_not\_be\_in\_set  
expect\_column\_values\_to\_be\_unique  
expect\_compound\_columns\_to\_be\_unique  
expect\_column\_values\_to\_not\_match\_like\_pattern  
expect\_column\_values\_to\_match\_like\_pattern  
expect\_column\_pair\_values\_to\_be\_in\_set  
expect\_multicolumn\_sum\_to\_equal

This issue is coming only when i am running the validation on a **Big Query External table**. When i create a normal Big Query table with the exact same data and execute the same check on it, it works as expected. It returns “False” for the check that should have some unexpected counts as per the data. However, for the same data and same check, it returns “True” for Big Query External table.

Code used:

> from datetime import datetime  
> import pandas as pd  
> from great\_expectations.checkpoint import SimpleCheckpoint  
> from great\_expectations.core.batch import BatchRequest, RuntimeBatchRequest
> 
> def database\_config():  
> import great\_expectations as gx  
> import os  
> os.environ[  
> ‘GOOGLE\_APPLICATION\_CREDENTIALS’] = r’cred.json’  
> projectID = ‘my\_id’  
> bigquery\_dataset = ‘my\_dataset’  
> context = gx.get\_context()  
> my\_connection\_string = f"bigquery://{projectID}/{bigquery\_dataset}"  
> datasource\_name = “my\_bigquery\_datasource”  
> datasource = context.sources.add\_or\_update\_sql(  
> name=datasource\_name,  
> connection\_string=my\_connection\_string,  
> )  
> return datasource, context, datasource\_name
> 
> def run(id):  
> datasource, context, datasource\_name = database\_config()
> 
> ```
> project_id = ""
> schema_name = ""
> table_name = ""
> 
> run_name = f"{id}"
> run_time = datetime.now()
> 
> run_id = {
> "run_name": run_name,
> "run_time": run_time
> }
> 
> start_time = datetime.now()
> expectation_suite_name = f"{id}"
> expectation_code = 'expect_column_values_to_be_in_set("Current_Foreclosure_Status", ["1", "3"])'
> 
> query_filter = f"select * from {project_id}.{schema_name}.{table_name}"
> 
> asset_name = f"{run_name}_my_query_asset"
> 
> query_asset = datasource.add_query_asset(name=asset_name, query=query_filter)
> 
> data_asset = context.get_datasource(datasource_name).get_asset(asset_name)
> 
> batch_request = data_asset.build_batch_request()
> 
> context.add_or_update_expectation_suite(expectation_suite_name)
> 
> validator = context.get_validator(
> batch_request=batch_request,
> expectation_suite_name=expectation_suite_name,
> )
> 
> s = "validator." + expectation_code
> eval(s)
> 
> validator.save_expectation_suite(
> discard_failed_expectations=False)
> 
> checkpoint = context.add_or_update_checkpoint(
> name="my_checkpoint",
> validations=[
> {
> "batch_request": batch_request,
> "expectation_suite_name": expectation_suite_name,
> },
> ],
> )
> 
> checkpoint_result = checkpoint.run()
> print(checkpoint_result)
> 
> ```

Note: this is a sample code. I am fetching the expectation\_code dynamically from a table in my database and executing the validation for each expectation in a for loop.
