Im using the below function to get all partitions from AWS Glue catalog table. There are some tables in the database that has more than 50K partitions. Is it possible to get only the partitions based on the 'LastAccessTime' attribute. I know I can filter from the list of all partitions but I want to see if there is any possible way, using the 'Expression' property of the get_partitions or something so I can avoid scanning the entire catalog table
def get_glue_partitions(glue_client, database_name, table_name):
"""Grabs all partitions for a table, and iterates through pagination."""
partitions = []
next_token = ''
while True:
resp = glue_client.get_partitions(
DatabaseName=database_name,
TableName=table_name,
NextToken=next_token)
partitions += resp['Partitions']
if 'NextToken' not in resp:
break
next_token = resp['NextToken']
return partitions