Read Parquet file stored in S3 with AWS Lambda (Python 3)

前端 未结 4 958
星月不相逢
星月不相逢 2021-01-02 03:23

I am trying to load, process and write Parquet files in S3 with AWS Lambda. My testing / deployment process is:

  • https://github.com/lambci/docker-lambda as a
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 04:08

    AWS has a project (AWS Data Wrangler) that allows it with full Lambda Layers support.

    In the Docs there is a step-by-step to do it.

    Code example:

    import awswrangler as wr
    
    # Write
    wr.s3.to_parquet(
        dataframe=df,
        path="s3://...",
        dataset=True,
        database="my_database",  # Optional, only with you want it available on Athena/Glue Catalog
        table="my_table",
        partition_cols=["PARTITION_COL_NAME"])
    
    # READ
    df = wr.s3.read_parquet(path="s3://...")
    

    Reference

提交回复
热议问题