djouallah commented on issue #7979:
URL: https://github.com/apache/iceberg/issues/7979#issuecomment-1619749717

   I guess this is bad :), I know you need a catalog, it is just for 
convenience that's all, but no strong opinion either way :)
   
   ```
   import boto3
   import pandas as pd
   s3_client = boto3.client('s3')
   bucket = 'xxxxxxxxxxxxxxxxxxxxxxxx'
   prefix = 'iceberg/metadata'
   paginator = s3_client.get_paginator('list_objects_v2')
   response_iterator = paginator.paginate(Bucket=bucket, Prefix=prefix)
   file_names = pd.DataFrame(columns=['file','date'])
   for response in response_iterator:
       for object_data in response['Contents']:
           key = object_data['Key']
           last = object_data['LastModified']
           if key.endswith('.json'):
               row = {'file': key,'date':last}
               file_names = 
pd.concat([file_names,pd.DataFrame(row,index=[key])] , axis=0, 
ignore_index=True)
   file_names.sort_values(by=['date'], ascending = False, inplace=True)
   file_names['file'].iat[0]
   Latest_metadata ='s3://' + bucket +'/'+ file_names['file'].iat[0]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to