How to make MSCK REPAIR TABLE execute automatically in AWS Athena

0 votes
What steps do I need to take to ensure MSCK REPAIR TABLE runs automatically in AWS Athena?
Oct 24 in AWS by Priyanka
• 4,500 points
148 views

1 answer to this question.

0 votes
  • I will show you how to automate the MSCK REPAIR TABLE in AWS Athena using AWS Glue Crawler or AWS Lambda.

  • Let me explain one by one.

  • If you use an AWS Glue Crawler, it will automatically scan your S3 bucket and keep your Athena table's metadata up-to-date. No need to manually run the MSCK REPAIR TABLE—Glue handles all of it for you!

  • This option is great for larger or more complex datasets.

  • Suppose you are using AWS Lambda. You can create a lambda function to run the command on your Athena table.

  • This is how you set up the Lambda function in Python.

              image

  • But remember to replace your_table_name with the name of your Athena table, your_database_name with the name of your database, and s3://your-query-results-bucket/ with the S3 location where you want Athena query results to be stored.

  • Lastly, a CloudWatch Event should be set up to trigger this Lambda function regularly.

Learn more about AWS Athena with this tutorial: Athena + Glue + S3 Data. Check it out here!

answered Oct 28 by Divya

Related Questions In AWS

0 votes
2 answers

How to skip headers when reading a CSV file in S3 and creating a table in AWS Athena?

Thanks for the answer. This should be clear ...READ MORE

answered Aug 14, 2019 in AWS by athenauserz
11,897 views
0 votes
1 answer

How to delete / drop multiple tables in AWS athena?

It is not possible to run multiple ...READ MORE

answered Jan 17, 2019 in AWS by Edureka
• 4,220 points
8,275 views
0 votes
1 answer

How to create a DynamoDB table in AWS?

Creating a DynamoDB table is made very ...READ MORE

answered Feb 22, 2019 in AWS by Priyaj
• 58,020 points
1,328 views
0 votes
1 answer
+3 votes
1 answer

How to make the instance IP static in nature? - AWS

Hey @Laksha! By default, all instances have a ...READ MORE

answered Apr 11, 2019 in AWS by Kalgi
• 52,350 points
1,517 views
+1 vote
1 answer
0 votes
1 answer

How to delete huge data from DynamoDB table in AWS?

Hi@akhtar, If you required to delete all the ...READ MORE

answered Dec 16, 2020 in AWS by MD
• 95,460 points
3,279 views
0 votes
1 answer

What is Data partitioning?

This is the process of partitioning tables, ...READ MORE

answered Aug 22, 2018 in Database by DataKing99
• 8,250 points
7,193 views
0 votes
1 answer

How to use aws s3 sync from the CLI?

Basically, This command is used to sync ...READ MORE

answered Oct 28 in AWS by Bhoomika
139 views
0 votes
1 answer

How to install ansible on amazon aws linux?

To install Ansible on Amazon AWS Linux, ...READ MORE

answered Oct 28 in AWS by anonymous
79 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP