Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

great-expectations>=0.14 causes commented_map missing error #56

Closed
park-peter opened this issue Oct 7, 2022 · 1 comment
Closed

great-expectations>=0.14 causes commented_map missing error #56

park-peter opened this issue Oct 7, 2022 · 1 comment

Comments

@park-peter
Copy link

I could not check if this has to do with Airflow 2.4.x, but I'm getting this error when using GreatExpectationsOperator with CheckpointConfig when using great-expectations>=0.14:

[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - Exception in thread Thread-1:
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - Traceback (most recent call last):
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 209, in assert_valid_keys
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     _ = self[name]
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 73, in __getitem__
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return getattr(self, item)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 151, in commented_map
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return self._get_schema_validated_updated_commented_map()
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 125, in _get_schema_validated_updated_commented_map
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     commented_map: CommentedMap = copy.deepcopy(self._commented_map)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - AttributeError: 'CheckpointConfig' object has no attribute '_commented_map'
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - 
During handling of the above exception, another exception occurred:
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - Traceback (most recent call last):
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 212, in assert_valid_keys
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     _ = self[f"_{name}"]
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 73, in __getitem__
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return getattr(self, item)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - AttributeError: 'CheckpointConfig' object has no attribute '_commented_map'
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - 
During handling of the above exception, another exception occurred:
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - Traceback (most recent call last):
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     self.run()
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/threading.py", line 917, in run
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     self._target(*self._args, **self._kwargs)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/openlineage/airflow/listener.py", line 114, in on_running
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     **get_custom_facets(task, dagrun.external_trigger, task_instance_copy)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/openlineage/airflow/utils.py", line 265, in get_custom_facets
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     "airflow_version": AirflowVersionRunFacet.from_task(task),
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/openlineage/airflow/facets.py", line 34, in from_task
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     to_json_encodable(task),
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/openlineage/airflow/utils.py", line 101, in to_json_encodable
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return json.loads(json.dumps(task.__dict__, default=_task_encoder))
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/json/__init__.py", line 234, in dumps
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return cls(
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/json/encoder.py", line 199, in encode
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     chunks = self.iterencode(o, _one_shot=True)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/json/encoder.py", line 257, in iterencode
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return _iterencode(o, 0)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/openlineage/airflow/utils.py", line 99, in _task_encoder
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return str(obj)
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2883, in __str__
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     return self.__repr__()
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2862, in __repr__
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     json_dict: dict = self.to_json_dict()
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2850, in to_json_dict
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     dict_obj: dict = self.to_dict()
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 140, in to_dict
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     for key in self.property_names(
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 227, in property_names
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     assert_valid_keys(keys=exclude_keys, purpose="exclusion")
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -   File "/usr/local/lib/python3.9/site-packages/great_expectations/types/__init__.py", line 214, in assert_valid_keys
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING -     raise ValueError(
[2022-10-07, 19:23:04 UTC] {logging_mixin.py:117} WARNING - ValueError: Property "commented_map", marked for exclusion on object "<class 'great_expectations.data_context.types.base.CheckpointConfig'>", does not exist.

I don't see this error with >=0.15, but with 0.14.x, I see this additional error:

[2022-10-07, 19:46:14 UTC] {taskinstance.py:1851} ERROR - Task failed with exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/util.py", line 117, in instantiate_class_from_config
    class_instance = class_(**config_with_defaults)
TypeError: __init__() got an unexpected keyword argument 'site_names'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/great_expectations_provider/operators/great_expectations.py", line 142, in execute
    self.checkpoint = instantiate_class_from_config(
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/util.py", line 121, in instantiate_class_from_config
    class_name, format_dict_for_error_message(config_with_defaults)
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/util.py", line 165, in format_dict_for_error_message
    return "\n\t".join("\t\t".join((str(key), str(dict_[key]))) for key in dict_)
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/util.py", line 165, in <genexpr>
    return "\n\t".join("\t\t".join((str(key), str(dict_[key]))) for key in dict_)
  File "/usr/local/lib/python3.9/site-packages/great_expectations/core/config_peer.py", line 80, in __repr__
    return str(self.get_config())
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2130, in __str__
    return self.__repr__()
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2109, in __repr__
    json_dict: dict = self.to_sanitized_json_dict()
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2098, in to_sanitized_json_dict
    serializeable_dict = self.to_json_dict()
  File "/usr/local/lib/python3.9/site-packages/great_expectations/data_context/types/base.py", line 2088, in to_json_dict
    serializeable_dict: dict = convert_to_json_serializable(data=dict_obj)
  File "/usr/local/lib/python3.9/site-packages/great_expectations/core/util.py", line 161, in convert_to_json_serializable
    new_dict[str(key)] = convert_to_json_serializable(data[key])
  File "/usr/local/lib/python3.9/site-packages/great_expectations/core/util.py", line 161, in convert_to_json_serializable
    new_dict[str(key)] = convert_to_json_serializable(data[key])
  File "/usr/local/lib/python3.9/site-packages/great_expectations/core/util.py", line 256, in convert_to_json_serializable
    raise TypeError(
TypeError: <great_expectations.data_context.types.base.DatasourceConfig object at 0x7f4009f096a0> is of type DatasourceConfig which cannot be serialized.

Current environment:
apache-airflow==2.4.1
airflow-provider-great-expectations==0.1.5
great-expectations>=0.14

I confirmed that the same DAG works with great-expectations==0.13.49 (this requires pinning jinja2>=3.0.0,<3.1.0)

@denimalpaca
Copy link
Contributor

I think there were just some issues with great-expectations>=0.14,<0.15 and I had 0.13.49 pinned for a long time for this reason.

@denimalpaca denimalpaca closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants