Łukasz Kastelik
Łukasz Kastelik

Reputation: 649

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?

Upvotes: 4

Views: 1950

Answers (2)

Josh Zheng
Josh Zheng

Reputation: 1

This should be fixed when you upgrade to the latest version of GX - 0.16.5

Upvotes: 0

Andrej Kesely
Andrej Kesely

Reputation: 195573

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()

Upvotes: 4

Related Questions