Joe Dattoli
Joe Dattoli

Reputation: 178

AWS Athena View Will not Drop

I'm trying to delete a view from Athena and continue to come across this error.

com.facebook.presto.v217.spi.PrestoException: Row type must have at least one parameter (Service: null; Status Code: 0; Error Code: null; Request ID: null; Proxy: null)

The view itself runs and returns as normal, but the DROP VIEW command produces the error. Also, I've tried to overwrite the view with a different query and still get the error.

Upvotes: 0

Views: 771

Answers (2)

Joe Dattoli
Joe Dattoli

Reputation: 178

Recreated the issue, and Theo's answer above solved it as well. I took a different approach that probably will not be considered best practices, but I just dropped the database and recreated its contents without the bad view. Make sure you have the view queries on-hand and ability to recreate tables with ease as the below command deletes them.

DROP DATABASE {name} CASCADE This drops the database and all it's contents since it is non-empty. Then, simply recreated the database and repopulated the views and tables.

CREATE DATABASE {name}

Once again, this deletes everything, so be cautious.

Upvotes: 0

Theo
Theo

Reputation: 132862

You can try deleting the view object from the Glue Data Catalog directly (that's where Athena stores it). You can do that either by navigating to the table in the Glue console, or by running this command:

$ aws glue delete-table \
  --region THE_REGION \
  --database-name THE_DATABASE \
  --name THE_NAME_OF_THE_VIEW

Upvotes: 1

Related Questions