Edits history of script submission #6011 for ' Read a file from S3 within a script (Python) (s3)'

  • python3
    #requirements:
    wmill>=1.251.7
    
    #Details on S3 integration at https://www.windmill.dev/docs/core_concepts/persistent_storage/large_data_files
    
    import wmill
    from wmill import S3Object
    
    def main(input_file: S3Object):
        # Load the entire file_content as a bytes array
        file_content = wmill.load_s3_file(input_file)
        print(file_content.decode('utf-8'))
    
        # Or load the file lazily as a Buffered reader:
        with wmill.load_s3_file_reader(input_file) as file_reader:
            print(file_reader.read())

    Submitted by henri186 834 days ago