How does the expect_column_values_to_be_of_type expectation work?

This post addresses a question about the expect_column_values_to_be_of_type expectation that was asked by a few users - what type does it validate exactly?

The expectation is about the “storage type” - the type is currently used to store a value. Contrast this with “what the value REALLY is”, let’s call it “semantic type”.

Let’s say that your table in a database has a VARCHAR column, but all the values in that column are unparsed numbers (e.g., “124”). If you use this expectation with type=integer, the validation will fail.

In this case you would need a new expectation, something like expect_column_values_to_be_castable_to_type. This expectation does not exist in the library. You can implement it for yourself as a custom expectation, or, even better, implement it and contribute it back to the community.