Search code examples
amazon-web-servicesamazon-s3julia

Upload DataFrame to AWS S3 bucket in Julia


It should be straightforward, but I could not find an example online as to what function/method to use. I am trying to upload a DataFrame object to an AWS S3 bucket in Julia. Do I need to save it first and then upload the file? I am using AWS and AWSS3 packages. Thanks!


Solution

  • (answer to comment)

    You can compress in-memory like this:

    using CodecZlib, TranscodingStreams
    
    buf = IOBuffer()
    stream = GzipCompressorStream(buf)
    CSV.write(stream, table)
    write(stream, TranscodingStreams.TOKEN_END)
    flush(stream)
    compressed_data = take!(buf)
    close(stream)
    # now put compressed_data to S3