azure - Great Expectation: Databricks-cannot import name 'get_context' from 'great_expectations.util&

I am following article from Great Expectations to try test cases. However, I am getting exception regar

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

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)

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 1
  • 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
Add a comment  | 

1 Answer 1

Reset to default 0

In 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信