簡體   English   中英

Boto3中無法識別AWS Athena?

[英]AWS Athena not being recognized in Boto3?

我正在嘗試通過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版,雅典娜對我來說很好用。

我使用您的botocore版本(1.5.19)設置了virtualenv,並且能夠復制您的問題。

您應該只升級您的botocore版本:

pip install --upgrade botocore

編輯:根據此github問題,對雅典娜的支持已包含在v1.5.52中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM