我正在尝试使用 AWS Lambda 在 S3 中加载、处理和编写 Parquet 文件。我的测试/部署过程是:
- https://github.com/lambci/docker-lambda作为模拟 Amazon 环境的容器,因为需要安装本机库(numpy 等)。
- 此过程生成 zip 文件:http ://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-deployment-pkg.html#with-s3-example-deployment-pkg-python
- 在 zip 中添加一个测试 python 函数,将其发送到 S3,更新 lambda 并对其进行测试
似乎有两种可能的方法,它们都在 docker 容器本地工作:
- fastparquet with s3fs:不幸的是,解压后的包大小超过 256MB,因此我无法用它更新 Lambda 代码。
带有 s3fs 的 pyarrow:我关注了https://github.com/apache/arrow/pull/916,当使用 lambda 函数执行时,我得到:
- 如果我在 URI 前加上 S3 或 S3N(如代码示例中所示):在 Lambda 环境
OSError: Passed non-file path: s3://mybucket/path/to/myfile
中的 pyarrow/parquet.py,第 848 行。在本地,我进入IndexError: list index out of range
pyarrow/parquet.py,第 714 行 - 如果我不使用 S3 或 S3N 作为 URI 前缀:它在本地工作(我可以读取镶木地板数据)。在 Lambda 环境中,我
OSError: Passed non-file path: s3://mybucket/path/to/myfile
在 pyarrow/parquet.py 的第 848 行中得到了相同的结果。
- 如果我在 URI 前加上 S3 或 S3N(如代码示例中所示):在 Lambda 环境
我的问题是:
- 为什么我在 docker 容器中得到的结果与在 Lambda 环境中得到的结果不同?
- 给出 URI 的正确方法是什么?
- 是否有一种可接受的方式通过 AWS Lambda 读取 S3 中的 Parquet 文件?
谢谢!