AWS Athena Drop Table + S3 Location

Viewed 277

I have a case where I need to drop the table and replace it using lambda functions. So far my first lambda function drops the table with the following SQL Query:

DROP TABLE IF EXISTS [dummytable]

I then have a second lambda that deletes the folder where the table existed to prevent "failure_reason": "HIVE_PATH_ALREADY_EXISTS:

So the second lambda deletes the path: s3://mytablesbucket/dummytable

Is there a way of achieving this with a single lambda?

1 Answers

Ofcourse Yes. In a single lambda function you can execute multiple statements. I am not sure which programming language you are using in lambda. But all languages support this.

Related