[英]AWS Glue Python-Shell : How to provide your own library?
我想让一个 aws 胶水 python-shell 作业连接到 MS SQL Server。 我知道我应该使用 pymssql 库。 在我的计算机上,我的脚本可以运行,但是使用 AWS 我知道我需要将 pymssql 库上传到 S3 并引用它。
如果我想连接到 redshift,我正在遵循 他们关于如何提供自己的 egg 文件 的示例,但是在创建 egg 文件并运行脚本后,我收到此错误
Couldn't find index page for 'redshift-module' (maybe misspelled?)
谁能帮助提供我如何完成提供我自己的图书馆? 在 redshift 或 ms sql 中。 只是寻找一个我可以适应和工作的例子。
完整作业日志
Creating /glue/lib/installation/site.py
Processing redshift_module-0.1-py3.7.egg
Copying redshift_module-0.1-py3.7.egg to /glue/lib/installation
Adding redshift-module 0.1 to easy-install.pth file
Installed /glue/lib/installation/redshift_module-0.1-py3.7.egg
Processing dependencies for redshift-module==0.1
Searching for redshift-module==0.1
Reading https://pypi.org/simple/redshift-module/
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
完整错误输出
Couldn't find index page for 'redshift-module' (maybe misspelled?)
No local packages or working download links found for redshift-module==0.1
error: Could not find suitable distribution for Requirement.parse('redshift-module==0.1')
答案在这里提到
简而言之, AWS Glue 使用 Python 3.6,而鸡蛋“redshift_module-0.1-py3.7.egg”是使用 Python 3.7 构建的
您可能还需要查看文档,其中包含一些有用的打包选项,例如install_requires=['package']
我在粘合作业中执行基本测试时遇到了同样的问题,在进一步调查我注意到 Glue Python shell 3 仅使用 Python 3.6 的场景时。 注意:使用不同版本的 python 创建的 egg 文件不会相互支持我在这个问题中观察到的。
要省略这一点,您需要制作一个与任何版本兼容的轮文件。
在 setup.py 文件所在的目录中运行以下命令: $ python3 setup.py bdist_wheel
将车轮文件上传到 S3 存储桶
转到 AWS 胶水作业控制台并创建新作业,提供所有必需的参数并将类型更改为“Python Shell”,并在“Python 库路径”中提供您的 s3 路径(wheel 文件所在的位置)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.