Adding Partitions to AWS Glue Catalog in Athena

Answer Correct answer: A — Use ALTER TABLE Orders ADD PARTITION(order_date='2023-01-01') LOCATION 's3://transactions/orders/order_date=2023-01-01'; to add partitions without scanning.

A data engineer creates an AWS Glue Data Catalog table by using an AWS Glue crawler that is named Orders. The data engineer wants to add the following new partitions: s3://transactions/orders/order_date=2023-01-01 s3://transactions/orders/order_date=2023-01-02 The data engineer must edit the metadata to include the new partitions in the table without scanning all the folders and files in the location of the table. Which data definition language (DDL) statement should the data engineer use in Amazon Athena?

  1. ALTER TABLE Orders ADD PARTITION(order_date=’2023-01-01’) LOCATION ‘s3://transactions/orders/order_date=2023-01-01’; Correct Answer
  2. MSCK REPAIR TABLE Orders;
  3. REPAIR TABLE Orders;
  4. ALTER TABLE Orders MODIFY PARTITION(order_date=’2023-01-01’) LOCATION ‘s3://transactions/orders/2023-01-01’;

Community Votes

A
100%

100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam trap is confusing manual partition addition with automated repair commands; MSCK REPAIR TABLE scans all folders, violating the constraint to avoid scanning.

This question tests the correct DDL syntax for manually adding specific partitions to an Amazon Athena table without triggering a full scan, leveraging the ALTER TABLE ADD PARTITION command.

Learners often select MSCK REPAIR TABLE because it is commonly used to sync Glue Catalog changes, but it ignores the explicit requirement to avoid scanning all files.

Community Discussion (4 comments)

Ja13 👍 5 Selected: A
Why the Other Options Are Incorrect: Option B: MSCK REPAIR TABLE Orders: This command is used to repair the partitions of a table by scanning all the files in the specified location. This is not efficient if you know the specific partitions you want to add, as it will scan the entire table location. Option C: REPAIR TABLE Orders: This is not a valid Athena DDL command. Option D: ALTER TABLE Orders MODIFY PARTITION: This command is used to modify the location of existing partitions, not to add new partitions. It would not work for adding new partitions.
artworkad 👍 4 Selected: A
A is correct as per https://docs.aws.amazon.com/athena/latest/ug/alter-table-add-partition.html
artworkad 👍 1
A is correct as per https://docs.aws.amazon.com/athena/latest/ug/alter-table-add-partition.html
tgv 👍 4 Selected: A
A is correct because it uses the appropriate DDL statements to add the new partitions directly without scanning all folders and files, meeting the requirements stated in the question. B is incorrect because while it would update the partitions, it would involve scanning all files and folders. C is incorrect because REPAIR TABLE is not a valid command. D is incorrect because it modifies partitions instead of adding new ones.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

To add specific partitions to an Amazon Athena table backed by an AWS Glue Data Catalog without scanning the entire S3 location, the data engineer must use the ALTER TABLE... ADD PARTITION statement. Option A correctly uses this DDL syntax, specifying the partition key-value pair and the exact S3 location. This approach is efficient and directly meets the requirement to update metadata for only the new dates.

Why the Other Options Are Wrong

Option B (MSCK REPAIR TABLE) is incorrect because it instructs Athena to scan the entire directory structure to discover missing partitions, which violates the constraint of not scanning all folders. Option C (REPAIR TABLE) is not a valid DDL command in Amazon Athena. Option D (MODIFY PARTITION) is syntactically invalid for adding new partitions; MODIFY is typically used to change properties of existing partitions, not create them, and the location path in D is also malformed relative to the partition key.

Community Comment Notes

Community consensus strongly supports Option A, with multiple users citing the official AWS documentation for ALTER TABLE ADD PARTITION. Comments highlight that MSCK REPAIR TABLE is inefficient for targeted updates and that REPAIR TABLE is invalid syntax. One user noted that Option D modifies rather than adds, reinforcing why A is the only viable choice for creating new entries.

Official Reference

Exam Strategy

When a question specifies 'without scanning', immediately eliminate MSCK REPAIR TABLE. Look for explicit ALTER TABLE ADD PARTITION statements that match the required partition keys and locations.

Frequently Asked Questions

Why is MSCK REPAIR TABLE wrong here?

MSCK REPAIR TABLE scans the entire S3 prefix to find missing partitions, which violates the requirement to avoid scanning all folders.

What is the difference between ADD and MODIFY PARTITION?

ADD creates a new partition entry in the catalog, while MODIFY updates properties of an existing partition. You cannot modify a non-existent partition.

More DEA-C01 FAQ →

Related Analysis

Practice All DEA-C01 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DEA-C01 Practice Test →

← Back to DEA-C01 Study Guide