great_expectations icon indicating copy to clipboard operation
great_expectations copied to clipboard

InvalidDataContextConfigError: Error while processing DataContextConfig: include_rendered_content

Open puruzio opened this issue 2 years ago • 2 comments

Describe the bug get_context() fails with this error message InvalidDataContextConfigError: Error while processing DataContextConfig: include_rendered_content

To Reproduce Steps to reproduce the behavior: Follow the example in the documentation here. https://docs.greatexpectations.io/docs/guides/connecting_to_your_data/in_memory/pandas/#2-instantiate-your-projects-datacontext The error occurs in the ge.get_context() line

Expected behavior No error in obtaining data context.

Environment (please complete the following information):

  • Operating System: [e.g. Linux, MacOS, Windows]
  • Great Expectations Version: [e.g. 0.13.2]

Additional context Full traceback:

InvalidDataContextConfigError             Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 val1 = ge.ge_validator(sf("select * from df where Source = 'SourceA' ")).expect_column_distinct_values_to_contain_set("AcctPeriod", h.list_ytd_yymm(glmonth))
      2 if not val1.success:
      3     ge.ge_results(val1)

File y:\datapipeline\lib\helpers_ge.py:35, in ge_validator(df)
     34 def ge_validator(df):
---> 35     context = ge.get_context()
     37     datasource_yaml = """
     38     name: df_raw_datasource
     39     class_name: Datasource
   (...)
     48                 - default_identifier_name
     49     """
     51     # default_runtime_data_connector_name:
     52     # class_name: RuntimeDataConnector
     53     # assets:
   (...)
     57 
     58     # context.test_yaml_config(yaml_config=datasource_yaml)

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\util.py:1312, in get_context()
   1309 def get_context():
   1310     from great_expectations.data_context.data_context import DataContext
-> 1312     return DataContext()

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\data_context\data_context.py:4209, in DataContext.__init__(self, context_root_dir, runtime_environment, ge_cloud_mode, ge_cloud_base_url, ge_cloud_account_id, ge_cloud_access_token, ge_cloud_organization_id)
   4206 context_root_directory = os.path.abspath(os.path.expanduser(context_root_dir))
   4207 self._context_root_directory = context_root_directory
-> 4209 project_config = self._load_project_config()
   4210 super().__init__(
   4211     project_config,
   4212     context_root_directory,
   (...)
   4215     ge_cloud_config=ge_cloud_config,
   4216 )
   4218 # save project config if data_context_id auto-generated or global config values applied

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\data_context\data_context.py:4288, in DataContext._load_project_config(self)
   4285     raise ge_exceptions.ConfigNotFoundError()
   4287 try:
-> 4288     return DataContextConfig.from_commented_map(
   4289         commented_map=config_commented_map_from_yaml
   4290     )
   4291 except ge_exceptions.InvalidDataContextConfigError:
   4292     # Just to be explicit about what we intended to catch
   4293     raise

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\data_context\types\base.py:90, in BaseYamlConfig.from_commented_map(cls, commented_map)
     87 @classmethod
     88 def from_commented_map(cls, commented_map: CommentedMap):
     89     try:
---> 90         config: Union[dict, BaseYamlConfig] = cls._get_schema_instance().load(
     91             commented_map
     92         )
     93         if isinstance(config, dict):
     94             return cls.get_config_class()(commented_map=commented_map, **config)

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\marshmallow__shade\schema.py:735, in Schema.load(self, data, many, partial, unknown)
    704 def load(
    705     self,
    706     data: typing.Union[
   (...)
    713     unknown: str = None,
    714 ):
    715     """Deserialize a data structure to an object defined by this Schema's fields.
    716 
    717     :param data: The data to deserialize.
   (...)
    733         if invalid data are passed.
    734     """
--> 735     return self._do_load(
    736         data, many=many, partial=partial, unknown=unknown, postprocess=True
    737     )

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\marshmallow__shade\schema.py:916, in Schema._do_load(self, data, many, partial, unknown, postprocess)
    914 if errors:
    915     exc = ValidationError(errors, data=data, valid_data=result)
--> 916     self.handle_error(exc, data, many=many, partial=partial)
    917     raise exc
    919 return result

File c:\Users\User1\AppData\Roaming\Python\Python39\site-packages\great_expectations\data_context\types\base.py:1330, in DataContextConfigSchema.handle_error(self, exc, data, **kwargs)
   1326 message: str = (
   1327     f"Error while processing DataContextConfig: {' '.join(exc.messages)}"
   1328 )
   1329 logger.error(message)
-> 1330 raise ge_exceptions.InvalidDataContextConfigError(
   1331     message=message,
   1332 )

puruzio avatar Sep 27 '22 03:09 puruzio

Hey @puruzio ! Thanks for raising this. We'll investigate internally and be in touch.

austiezr avatar Sep 30 '22 16:09 austiezr

Hey!

I've been getting the same error recently as well. I've noticed that this occurs when I have two Jupyter servers running on the same python interpreter (two terminal windows with the same Python instance). I know this may be a niche case but it is nice to be able to edit multiple expectation suites at once.

Hopefully this helps in your investigation efforts! Let me know if I can be of any assistance.

joshuachapnick-bc avatar Oct 19 '22 14:10 joshuachapnick-bc

Hey @puruzio ! Are you able to confirm that you're still experiencing this issue on the most recent versions of Great Expectations?

@joshuachapnick-bc would you be willing to surface your use-case in a separate issue? That will help us to better investigate your scenario.

austiezr avatar Nov 07 '22 16:11 austiezr

@austiezr Yes, there is no more error in "version": "==0.15.26" Thank you!

puruzio avatar Nov 08 '22 19:11 puruzio