Athena/Presto MSCK REPAIR TABLE command fails with error

Issue Summary

Thought I might be able to use Redash’s scheduled query function to periodically run an MSCK REPAIR TABLE command on a partitioned AWS Athena (Presto) table to update the partitions.

However, if I try an execute a query like this e.g.

MSCK REPAIR TABLE my_database.my_table;

I get an error:

Error running query: FAILED: ParseException line 1:0 cannot recognize input near ‘/’ ‘*’ 'Username’

This is a bit puzzling as it works in the Athena query console and also via a JDBC connection from a different query tool. Is this because the query doesn’t return a tabular result set?

Technical details:

  • Redash Version: 7.0.0+b18042 Version
  • Browser/OS: Chrome Version 76.0.3809.132 (Official Build) (64-bit) / Linux
  • How did you install Redash: Self hosted from recommended AWS EC2 image

Redash sends every query with a comment at the top that provides some metadata on who sent this.

To disable this behavior for Athena, in /opt/redash/env file (I’m assuming you’re using the Docker based image) add:

ATHENA_ANNOTATE_QUERY=false

And then run docker-compose up -d from /opt/redash.

2 Likes

Works perfectly, thanks!