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.