gpt4 book ai didi

python - AWS Athena 未在 Boto3 中被识别?

转载 作者:太空宇宙 更新时间:2023-11-04 09:59:05 24 4
gpt4 key购买 nike

我正在尝试从 CLI 和通过 boto3 使用 AWS Athena,但由于某种原因它没有被识别。我已经升级到最新版本的boto3

boto3.__version__
>>'1.4.4'

aws --version
>>aws-cli/1.11.56 Python/3.6.0 Darwin/15.6.0 botocore/1.5.19

当我执行 client = boto3.client('athena') 时,我收到了:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/boto3/__init__.py", line 83, in client
return _get_default_session().client(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/boto3/session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/session.py", line 836, in create_client
client_config=config, api_version=api_version)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/client.py", line 63, in create_client
service_model = self._load_service_model(service_name, api_version)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/client.py", line 93, in _load_service_model
api_version=api_version)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/loaders.py", line 132, in _wrapper
data = func(self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/loaders.py", line 378, in load_service_model
known_service_names=', '.join(sorted(known_services)))
botocore.exceptions.UnknownServiceError: Unknown service: 'athena'. Valid service names are: acm, apigateway, application-autoscaling, appstream, autoscaling, batch, budgets, clouddirectory, cloudformation, cloudfront, cloudhsm, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, codebuild, codecommit, codedeploy, codepipeline, cognito-identity, cognito-idp, cognito-sync, config, cur, datapipeline, devicefarm, directconnect, discovery, dms, ds, dynamodb, dynamodbstreams, ec2, ecr, ecs, efs, elasticache, elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, firehose, gamelift, glacier, health, iam, importexport, inspector, iot, iot-data, kinesis, kinesisanalytics, kms, lambda, lex-runtime, lightsail, logs, machinelearning, marketplacecommerceanalytics, meteringmarketplace, mturk, opsworks, opsworkscm, organizations, pinpoint, polly, rds, redshift, rekognition, route53, route53domains, s3, sdb, servicecatalog, ses, shield, sms, snowball, sns, sqs, ssm, stepfunctions, storagegateway, sts, support, swf, waf, waf-regional, workspaces, xray

CLI 也一样,当我执行 aws athena help 时,我得到一个无效选项。知道为什么会这样吗?我正在尝试自动执行一项任务,而不是坐在 GUI 中反复输入查询。

最佳答案

您的问题似乎与您的 botocore 版本有关。

我有 botocore 1.5.55 版,athena 适合我。

我用你的 botocore (1.5.19) 版本设置了一个 virtualenv,我能够重现你的问题。

你应该只升级你的 botocore 版本:

pip install --upgrade botocore

编辑:根据this github issue v1.5.52 中包含对 Athena 的支持

关于python - AWS Athena 未在 Boto3 中被识别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44615959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com