python - running aws athena query via pyathena -


this query works fine in athena's front-end:

select * analysisdata."iris" limit 10; 

i using python code run above query via python/pyathena

from pyathena import connect  cursor = connect(aws_access_key_id='aki.deleted.2q',                  aws_secret_access_key='d.deleted.al',                  s3_staging_dir='s3://bla887342ac-a3ce-4600-94d0-9092f4a6bd20/iris',                  region_name='eu-west-1').cursor()  cursor.execute("""select * analysisdata.""iris"" limit 10;""")  print(cursor.description) print(cursor.fetchall()) 

unfortunately get:

pyathena.error.databaseerror: error occurred (invalidrequestexception) when calling startqueryexecution operation: line 1:27: mismatched input '.' expecting {<eof>, ',', 'where', 'group', 'order', 'having', 'limit', 'approximate', 'join', 'cross', 'inner', 'left', 'right', 'full', 'natural', 'union', 'except', 'intersect'} 

i presume introduction of:

""" , "" 

any ideas?

ps:

i tried:

cursor.execute("select * analysisdata.""iris"" limit 10;") 

get:

pyathena.error.operationalerror: com.facebook.presto.hive.datacatalogexception: namespace analysisdata not found. please check query. 

why facebook appear in this?

i tried:

cursor.execute("select * analysisdata.iris limit 10;") 

same error message ...

as appears, catalog in eu-west-1 not contain analysisdata db.

you have specify region in created database/table in athena console, rather specified s3 bucket region.

to solve that, log console, , verify region contains database/table.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -