- Newest
- Most votes
- Most comments
Job bookmarks in AWS Glue do not strictly require the bookmark key to be a primary key in the source table. While using a primary key as the bookmark key is often recommended, it's not mandatory. The most important characteristic of a good bookmark key is that it should be monotonically increasing with no gaps.
In your case, using the "Modtime" field as the bookmark key is a valid approach, especially since you mentioned that it's always increasing monotonically with no gaps. This meets the primary requirement for an effective job bookmark key.
The fact that there can be multiple entries with the same "Modtime" value doesn't necessarily pose a problem, as long as your job logic can handle processing all records with the same timestamp correctly. However, you should be cautious and ensure that your job can consistently process all records, including those with identical "Modtime" values, without missing any data or creating duplicates.
It's worth noting that while your current setup is working fine and you haven't noticed any discrepancies or duplicate entries in the target table, you should continue to monitor the job closely. Ensure that all data is being processed correctly, especially in scenarios where multiple records share the same "Modtime" value.
To summarize, while using a primary key as the job bookmark key is often ideal, it's not strictly necessary. The key requirements for a job bookmark are:
- It should be monotonically increasing.
- It should have no gaps.
- It should allow for consistent and complete processing of all records.
Your current approach using the "Modtime" field appears to meet these criteria. However, always remain vigilant and continue to monitor your job's performance and accuracy to ensure it maintains data integrity over time.
Sources
Job runs - AWS Glue
GetJobBookmark - AWS Glue
Relevant content
asked 2 years ago
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago

Thanks for the feedback. Yes i am currently monitoring my glue job and also target data. It has insert correctly all the rows which has same Modtime field values. One question i have used write_dynamic_frame.from_options with partitionKeys [] does it has any impact on bookmark key ? Instead of write_dynamic_frame.from_options if i used below method where i repartition and handle empty file then it does not have any impact on job bookmark logic correct ?
df_trt = AWSGlueDataCatalog_node1712075257312.toDF()
Repartition the DataFrame to control output files trt
df_repartitioned_trt = df_trt.repartition(10) # Adjust '10' based on your data volume
Check for empty partitions and write only if data is present
if not df_repartitioned_trt.rdd.isEmpty(): df_repartitioned_trt.write.format("csv")
.option("compression", "gzip")
.option("header", "true")
.option("delimiter", "®")
.save(output_path)