【问题标题】:AWS Data Wrangler - wr.athena.read_sql_query doesn't workAWS Data Wrangler - wr.athena.read_sql_query 不起作用
【发布时间】:2022-11-03 03:39:35
【问题描述】:

我开始使用 AWS Data Wrangler lib (https://aws-data-wrangler.readthedocs.io/en/stable/what.html)

在 AWS Athena 上执行查询并在我的 AWS Glue python shell 作业中使用它们的结果。

我看到存在 wr.athena.read_sql_query 以获得我需要的东西。

这是我的代码:

import sys
import os
import awswrangler as wr

os.environ['AWS_DEFAULT_REGION'] = 'eu-west-1'
databases = wr.catalog.databases()
print(databases)

query='select count(*) from staging_dim_channel'
print(query)
df_res = wr.athena.read_sql_query(sql=query, database="lsk2-target")
print(df_res)
print(f'DataScannedInBytes:            {df_res.query_metadata["Statistics"]["DataScannedInBytes"]}')
print(f'TotalExecutionTimeInMillis:    {df_res.query_metadata["Statistics"]["TotalExecutionTimeInMillis"]}')
print(f'QueryQueueTimeInMillis:        {df_res.query_metadata["Statistics"]["QueryQueueTimeInMillis"]}')
print(f'QueryPlanningTimeInMillis:     {df_res.query_metadata["Statistics"]["QueryPlanningTimeInMillis"]}')
print(f'ServiceProcessingTimeInMillis: {df_res.query_metadata["Statistics"]["ServiceProcessingTimeInMillis"]}')

我毫无问题地检索了数据库列表(包括 lsk2-target),但是 read_sql_query 继续出错并且我收到:

WaiterError: Waiter BucketExists failed: Max attempts exceeded

拜托,你能帮我理解我错在哪里吗? 谢谢!

【问题讨论】:

  • 我解决了使用 Boto3 for Athena

标签: amazon-web-services aws-glue amazon-athena


【解决方案1】:

您是否具有读取执行查询的正确 IAM 权限?我敢打赌这是一个 IAM 问题。

另外我猜你已经设置了你的凭据:

[default]
aws_access_key_id = your_access_key_id
aws_secret_access_key = your_secret_access_key

【讨论】:

    猜你喜欢
    • 2023-01-13
    • 2021-03-09
    • 2022-11-03
    • 2013-10-20
    • 1970-01-01
    • 1970-01-01
    • 2018-11-12
    • 2020-03-15
    • 2017-08-10
    相关资源
    最近更新 更多