首页 > 解决方案 > 无法通过 cli 和 test_yaml_config 在 great_expections 中将数据源设置为 aws s3

问题描述

great_expectations 设置:

创建了一个新的虚拟环境安装了所需的包:

pip install boto3
pip install fsspec
pip install s3fs

更新配置中的数据源:great_expectations.yml

datasources:
  pandas_s3:
    class_name: PandasDatasource

重现此问题的步骤:

> great_expectations init
Would you like to profile new Expectations for a single data asset within your new Datasource? [Y/n]: Y
Enter the path of a data file (relative or absolute, s3a:// and gs:// paths are ok too)
: s3://my-bucket-name/

We could not determine the format of the file. What is it?
    1. CSV
    2. Parquet
    3. Excel
    4. JSON
: 2

出现以下错误:

无法连接到主机 s3.amazonaws.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1123)')]

注意:我已准备好 aws 的设置。~/.aws 具有以下内容的凭据文件。

output = json
region = us-east-1
aws_access_key_id = api-key
aws_secret_access_key = secret-key
aws_session_token = sesssion-token
aws_default_acl = None

使用与上述相同的设置,

注意:下面的代码工作正常:

import boto3
import io
import pandas as pd

def pd_read_s3_parquet(key, bucket, s3_client=None, **args):
    if s3_client is None:
        s3_client = boto3.client('s3')
    obj = s3_client.get_object(Bucket=bucket, Key=key)
    return pd.read_parquet(io.BytesIO(obj['Body'].read()), **args)

print(pd_read_s3_parquet(key="books.parquet", bucket="books-bucket-ge"))

因此,通过 ge 库的连接阻碍了方式。

使用 test_yaml_config 的 V3 batch_request API 面临同样的问题。

使用版本 0.13.10

对此被阻止,请提出解决此问题的方法。谢谢!

标签: great-expectations

解决方案


我相信海报为这个问题创建了这个 GitHub 问题:https ://github.com/great-expectations/great_expectations/issues/2541 。请使用它来跟踪任何进一步的对话。


推荐阅读