无法通过 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

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

解决方法

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