I am following article from Great Expectations to try test cases. However, I am getting exception regarding get_context
.
When I try to execute command
from great_expectations.util import get_context
It throws exception. Exception detail are
ImportError: cannot import name 'get_context' from 'great_expectations.util' (/local_disk0/.ephemeral_nfs/envs/pythonEnv-e053b0a2-5a41-4a6b-9156-547a7ba12dfb/lib/python3.11/site-packages/great_expectations/util.py)
I am following article from Great Expectations to try test cases. However, I am getting exception regarding get_context
.
When I try to execute command
from great_expectations.util import get_context
It throws exception. Exception detail are
Share Improve this question edited Mar 24 at 13:13 margusl 18.4k3 gold badges22 silver badges29 bronze badges asked Mar 21 at 8:23 rami amanrami aman 32 bronze badges 1ImportError: cannot import name 'get_context' from 'great_expectations.util' (/local_disk0/.ephemeral_nfs/envs/pythonEnv-e053b0a2-5a41-4a6b-9156-547a7ba12dfb/lib/python3.11/site-packages/great_expectations/util.py)
- This could be due to changes in the Great Expectations library since the article was written. – Dileep Raj Narayan Thumula Commented Mar 23 at 10:56
1 Answer
Reset to default 0In this case, the document you are referring is outdated.
In older versions of Great Expectations (before v0.16), get_context
was accessed differently.
In latest versions, get_context()
is provided under great_expectations
, and not under great_expectations.util
.
Below I have used the code from latest document of Great Expectation and It ran successfully without any error:
Code:
import datetime
import pandas as pd
from ruamel import yaml
from great_expectations.core.batch import RuntimeBatchRequest
from great_expectations import get_context
from great_expectations.data_context.types.base import (
DataContextConfig,
FilesystemStoreBackendDefaults,
)
Kindly go through the latest document of Greatest Expectations:
Great Expectations
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744366366a4570722.html
评论列表(0条)