2

I'm trying to create Athena table and then make some SELECT statement.

I've moved the connection to the lambda function:

cursor = lambda: connect(s3_staging_dir=STG_DIR).cursor()

and then I'm doing some DDL, that creates external Athena table and trying to execute SELECT statement:

cursor().execute("""SELECT * FROM {database}.{table} limit {records}""".format(database=database, table=table, records=n)) res = cursor().fetchall()

And I receive:

pyathena.error.ProgrammingError: No result set.

but actually data exists in the table.

Nathan Griffiths
  • 12,277
  • 2
  • 34
  • 51
mi.mo
  • 81
  • 2
  • 6
  • Have you checked the actual SQL being generated for the SELECT statement and manually run that on Athena to confirm it works as you expect? If that SQL is invalid or references the wrong table you might be getting no result. – Nathan Griffiths Sep 21 '19 at 01:29
  • yes, the query is correct, I tried to execute it on Athea UI and it works – mi.mo Sep 23 '19 at 10:28

0 Answers0