Skip to content

Athena Query Error using Python

0

Getting this error when try to start an Athena query using Python:

"Error details TABLE_NOT_FOUND: line 5:11: Table 'awsdatacatalog.athenacurcfn_c_u_r_athena.cur_athena' does not exist This query ran against the "athenacurcfn_c_u_r_athena" database, unless qualified by the query. "

query error

However, if I click on "Run Again" in the exact same way, it works fine.

Enter image description here

Python code is pretty standard, not sure why it´s failing. Any ideas? Thanks a lot

                  query_execution_context = {
                      "Database": athena_database,
                      "Catalog": "AwsDataCatalog",
                  }
                  
                  # Execute Athena query
                  response = athena_client.start_query_execution(
                      QueryString=query,
                      QueryExecutionContext=query_execution_context,
                      ResultConfiguration={
                          'OutputLocation': f's3://{s3_bucket}/{s3_prefix}/',
                          'EncryptionConfiguration': {
                              'EncryptionOption': 'SSE_S3'
                            },
                          },
                  )
  • I'm running into the same issue while connecting a python query to connect to Athena database. I'm getting the below error "TABLE_NOT_FOUND: line 1:15: Table 'Catalogue name.database_name.table_name' does not exist"

    This query ran against the "database_name" database, unless qualified by the query. Snippet from the python script:

    import boto3 import time

    Note - Glue IAM permission is also given

AWS
asked 10 months ago198 views
1 Answer
0
Accepted Answer

**Resolved: *Lambda IAM role was missing the permission "Allow: glue:Get", after configuring it the table was found correctly.

AWS
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.