Welcome to Great Expectations, FileDataAsset!

Great Expectations
May 1 · 4 min read
expect_file_to_exist
expect_file_size_to_be_between
expect_file_hash_to_equal
expect_file_to_have_valid_table_header
expect_file_to_be_valid_json
expect_file_line_regex_match_count_to_be_between
expect_file_line_regex_match_count_to_equal
{
"data_asset_name": "daily_delivery",
"data_asset_type": "FileDataAsset",
"meta": {
"great_expectations.__version__": "0.5.1"
},
"expectations": [
{
"expectation_type": "expect_file_to_exist",
"kwargs": {
"filepath": {
"$PARAMETER": "filename"
}
}
}
]
}
{
"data_asset_name": "daily_delivery",
"data_asset_type": "FileDataAsset",
"meta": {
"great_expectations.__version__": "0.5.1"
},
"expectations": [
{
"expectation_type": "expect_file_line_regex_match_count_to_be_between",
"kwargs": {
"regex": "\\|",
"expected_min_count": 268,
"expected_max_count": 268
}
}
]
}
> asset.expect_file_line_regex_match_count_to_be_between(r'\|', 3, 3, result_format="SUMMARY")> {'success': False,
'result': {'element_count': 12,
'missing_count': 2,
'missing_percent': 0.16666666666666666,
'unexpected_count': 2,
'unexpected_percent': 0.16666666666666666,
'unexpected_percent_nonmissing': 0.2,
'partial_unexpected_list': ['B|"C|"|5|4\n', 'B|"why| C"|1|4\n'],
'partial_unexpected_index_list': [4, 5],
'partial_unexpected_counts': [{'value': 'B|"C|"|5|4\n', 'count': 1},
{'value': 'B|"why| C"|1|4\n', 'count': 1}]}}
> asset.expect_file_line_regex_match_count_to_equal(r'\|(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)', 3,  meta={"notes": "We observed quoted pipes in about 15 percent of the first test dataset; for example ‘B|\”C|\”|5|4’"}){
"data_asset_name": "daily_delivery",
"data_asset_type": "FileDataAsset",
"meta": {
"great_expectations.__version__": "0.5.0"
},
"expectations": [
{
"expectation_type": "expect_file_line_regex_match_count_to_be_between",
"kwargs": {
"regex": "\\|",
"expected_min_count": 3,
"expected_max_count": 3
}
},
{
"expectation_type": "expect_file_line_regex_match_count_to_equal",
"kwargs": {
"regex": "\\|(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)",
"expected_count": 3
},
"meta": {
"notes": "We observed quoted pipes in about 15 percent of the first test dataset; for example \u2018B|\\\u201dC|\\\u201d|5|4\u2019"
}
}
]
}

Great Expectations

Written by

The official blog of the Great Expectations open source project.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade