great_expectations
great_expectations copied to clipboard
expect_column_values_to_of_type does not work
Describe the bug I am trying to use expect_column_values_to_be_of_type to verify the type of my datasource (from big query tables) using this expectation from the gallery .https://greatexpectations.io/expectations/expect_column_values_to_be_of_type
my syntaxe {
"expectation_type": "expect_column_values_to_be_of_type",
"kwargs": {
"column": "date_debut",
"type_": "DATE",
"mostly": 1.0
},
"meta": {}
},
I tried with different type but always got the same error below
expect_column_values_to_be_of_type raised an exception:
'type'[Show exception traceback...](https://ofr-bdf-lab-great-expect-prd.ey.r.appspot.com/validations/etask_otomate_189_expectation/20220722-115505-etask-otomate-189/20220722T115505.005936Z/03fd1fdc4deef8a2a0d630010f56b127.html#section-6-content-block-2-cell-1-2-content-2-collapse-body-0297dd0d-f50c-4184-acb4-6bcf350923e9)
Traceback (most recent call last):
File "C:\Applications\Python\venv\lib\site-packages\great_expectations\validator\validator.py", line 979, in graph_validate
result = configuration.metrics_validate(
File "C:\Applications\Python\venv\lib\site-packages\great_expectations\core\expectation_configuration.py", line 1371, in metrics_validate
return expectation_impl(self).metrics_validate(
File "C:\Applications\Python\venv\lib\site-packages\great_expectations\expectations\expectation.py", line 706, in metrics_validate
] = self._validate(
File "C:\Applications\Python\venv\lib\site-packages\great_expectations\expectations\core\expect_column_values_to_be_of_type.py", line 522, in _validate
actual_column_type = [
File "C:\Applications\Python\venv\lib\site-packages\great_expectations\expectations\core\expect_column_values_to_be_of_type.py", line 523, in
type_dict["type"]
KeyError: 'type'
Expected behavior I expect it to verify the type of my column
Environment (please complete the following information):
- Operating System: [Windows]
- Great Expectations Version: [0.15.9]
While exmaninated the column_values_to_be_of_type metric on the the folder site-packages\great_expectations\expectations\metrics i didn't see any definition of def _sqlalchemy(cls, column, _dialect, **kwargs could this be the problem ?
Howdy @syrineMH 👋 thanks for raising this with us 🙇
We'll bring this up with the team. We may need to reach back out if we need anything further in doing so. Thank you very much 🔬
The same issue is with the expect_column_values_to_be_in_type_list
expectations
version 0.15.26
same issue with redshift+psycopg2
Hey @syrineMH , @serg-music , and @tooptoop4 , I'm working on reproducing the error and so far have only seen it working as expected. I've tried it with a few datasource types, including against bigquery with gx 0.15.9.
A few questions:
- Are you able to share your bigquery schema?
- What version of python are you using?
- What version of
sqlalchemy-bigquery
do you have installed? - If you put a breakpoint on the line throwing the exception in your stacktrace (the one referencing
type_dict["type"]
), what do you actually see for the objects inactual_column_types_list
? e.g. if you print[t for t in actual_column_types_list if t["name"] == column_name][0]
I'm closing this issue for now. Please share more information if the problem persists.
Hi, I'm also running into this problem while using a Snowflake datasource checking the type of the columns.
Here're the specs,
- python==3.10.13
- great_expectatinos==0.18.10
- SQLAlchemy==1.4.51
- snowflake-connector-python==2.8.3
- snowflake-sqlalchemy==1.4.7
I was debugging through this and found that the metrics it pulled only has name
in the dict
stack trace