Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete / drop multiple tables in AWS athena?

I am trying to drop few tables from Athena and I cannot run multiple DROP queries at same time. Is there a way to do it?

Thanks!

like image 809
Vidy Avatar asked Mar 29 '18 14:03

Vidy


1 Answers

You are correct. It is not possible to run multiple queries in the one request.

An alternative is to create the tables in a specific database. Dropping the database will then cause all the tables to be deleted.

For example:

CREATE DATABASE foo;
CREATE EXTERNAL TABLE bar1 ...;
CREATE EXTERNAL TABLE bar2 ...;
DROP DATABASE foo CASCADE;

The DROP DATABASE command will delete the bar1 and bar2 tables.

like image 155
John Rotenstein Avatar answered Oct 15 '22 06:10

John Rotenstein