# Setting up a batchrequest with pattern

**URL:** https://discourse.greatexpectations.io/t/setting-up-a-batchrequest-with-pattern/978
**Category:** Archive
**Created:** [January 19, 2022, 10:50am UTC](https://discourse.greatexpectations.io/t/setting-up-a-batchrequest-with-pattern/978 "2022-01-19T10:50:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Andy](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Andy](https://discourse.greatexpectations.io/u/Andy)
#### Post date: [January 19, 2022, 10:50am UTC](https://discourse.greatexpectations.io/t/setting-up-a-batchrequest-with-pattern/978/1 "2022-01-19T10:50:12Z")

</div>

Hello Great Expectations community,

Please bear with me, I have only used GE for some weeks and I guess I only have misunderstood something regarding how to set the pattern correctly for my asset. I have attached my python code below.

## First I set up the Azure Blob Storeage data source and test it. Everything working as expected and it finds four matches correctly in the blob storeage.

ExecutionEngine class name: PandasExecutionEngine  
Data Connectors:  
default\_configured\_data\_connector\_name : ConfiguredAssetAzureDataConnector

```
Available data_asset_names (1 of 1):
	inference_year_month (3 of 4): ['cases_2021-06-*.csv', 'cases_2021-06-*.csv', 'cases_2021-07-*.csv']

Unmatched data_references (0 of 0):[]

```

* * *

The file names are built up by the pattern: “cases\_YYYY-MM-DD.csv”. I don’t want to specify the DD-part so I set it to “.\*” in the regexp pattern below. Though I want to set the year and month in the “data\_connector\_query”. So by doing this I hope that it finds (and match) out which files exists given the year and month.

Next I try to add a BatchRequest based on this data source, but when I test it with the get\_batch\_list(..) I receive an error:  
“ResourceNotFoundError: The specified blob does not exist.  
RequestId:c6908321-b01e-0027-3a1a-0d5693000000  
Time:2022-01-19T09:51:18.7407504Z  
ErrorCode:BlobNotFound”.

If I hardcode the DD-part (e.g “cases\_(\d{4})-(\d{2})-29\.csv”) instead of using “.\*” in the pattern argument - it actually works (no error - it finds and load the file). So the problem seems related to the DD-part.

I use great-expectations version 0.14.0

I hope I made myself clear and you understand my problem. Hope you can bring some advice / hint on what’s my problem is. 🙂

My code:  
datasource\_config = {  
“name”: “my\_azure\_datasource”,  
“class\_name”: “Datasource”,  
“execution\_engine”: {  
“class\_name”: “PandasExecutionEngine”,  
“azure\_options”: {  
“account\_url”: “[https://xxxx.blob.core.windows.net/](https://xxxx.blob.core.windows.net/)”,  
“credential”: “xxxx”,  
},  
},  
“data\_connectors”: {  
“default\_configured\_data\_connector\_name”: {  
“class\_name”: “ConfiguredAssetAzureDataConnector”,  
“azure\_options”: {  
“account\_url”: “[https://xxxxxx.blob.core.windows.net/](https://xxxxxx.blob.core.windows.net/)”,  
“credential”: “xxxxx”,  
},  
“container”: “blobstore-xxxx”,  
“name\_starts\_with”: “”,  
“default\_regex”: {  
“pattern”: “(._)",  
“group\_names”: [“data\_asset\_name”]  
},  
“assets”: {  
“inference\_year\_month”: {  
“base\_directory”: “”,  
“pattern”: "cases\_(\d{4})-(\d{2})-._\.csv”,  
“group\_names”: [“year”, “month”]  
}  
}  
},  
},  
}

# Test configuration

context.test\_yaml\_config(yaml.dump(datasource\_config))

# Save the data source configuration

context.add\_datasource(\*\*datasource\_config)

data\_connector\_query\_202107 = {  
“batch\_filter\_parameters”: {  
“year”: “2021”,  
“month”: “07”  
}  
}

# Create batch / data set

batch\_request = BatchRequest(  
datasource\_name=“my\_azure\_datasource”,  
data\_connector\_name=“default\_configured\_data\_connector\_name”,  
data\_asset\_name=“inference\_year\_month”,  
batch\_spec\_passthrough={  
“reader\_method”: “csv”,  
“reader\_options”: {“sep”: “;”}  
},  
data\_connector\_query=data\_connector\_query\_202107  
)

# List all Batches associated with the DataAsset

context.get\_batch\_list(  
datasource\_name=“my\_azure\_datasource”,  
data\_connector\_name=“default\_configured\_data\_connector\_name”,  
data\_asset\_name=“inference\_year\_month”  
)

Thanks  
Andy
