Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot run Great Expectations quickstart

I am trying to use Great Expectations (Python data quality framework). I ran the quickstart after installing GX on WSL2 and Python 3.9.16

The quickstart code can be found here: https://docs.greatexpectations.io/docs/tutorials/quickstart/

I am getting an error at the last statement:

context.convert_to_file_context()

AttributeError: 'FileDataContext' object has no attribute 'convert_to_file_context'

What am I doing wrong?

like image 844
BuahahaXD Avatar asked Oct 20 '25 12:10

BuahahaXD


1 Answers

When you run the demo for first time the context = gx.get_context() creates EphemeralDataContext that has the method convert_to_file_context().

Note the great_expectations/ folder that has been created.


When you run the demo next time context = gx.get_context() creates FileDataContext that doesn't have this method.

You can add a check for the type to the code, for example:

from great_expectations.data_context.data_context import EphemeralDataContext

# ...

if isinstance(context, EphemeralDataContext):
    context.convert_to_file_context()
like image 125
Andrej Kesely Avatar answered Oct 23 '25 00:10

Andrej Kesely