AWS Glue Python-Shell : 如何提供自己的库?
AWS Glue Python-Shell : How to provide your own library?
我想要一个 aws glue python-shell 作业连接到 MS SQL 服务器。我知道我应该使用 pymssql 库。在我的电脑上我有脚本工作但是使用 AWS 我知道我需要将 pymssql 库上传到 S3 并引用它。
如果我想连接到 redshift,我正在关注 their example 如何提供你自己的 egg 文件,但是在创建 egg 文件和 运行 脚本后我得到了这个错误
Couldn't find index page for 'redshift-module' (maybe misspelled?)
任何人都可以帮助提供我如何完成提供我自己的图书馆吗?在红移或 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')
提到答案here
在坚果 shell 中,AWS Glue uses Python 3.6 而鸡蛋 'redshift_module-0.1-py3.7.egg' 是使用 python 3.7
构建的
您可能还需要查看 documentation,它有一些有用的打包选项,例如 install_requires=['package']
我在 glue 作业中执行基本测试时遇到了同样的问题,在进一步调查场景时我注意到 Glue Python shell 3 仅使用 Python 3.6。注意:使用不同版本的 python 创建的 egg 文件将不会相互支持我在本期中观察到的情况。
要省略这一点,您需要制作一个与任何版本兼容的 wheel 文件。
运行 在您的 setup.py 文件存在的目录中执行以下命令:
$ python3 setup.py bdist_wheel
上传wheel文件到S3 bucket
转到 AWS glue 作业控制台并创建新作业,提供所有必需的参数并将类型更改为“Python Shell”并提供您的 s3 路径(其中 wheel文件存在)在“Python 库路径”
我想要一个 aws glue python-shell 作业连接到 MS SQL 服务器。我知道我应该使用 pymssql 库。在我的电脑上我有脚本工作但是使用 AWS 我知道我需要将 pymssql 库上传到 S3 并引用它。
如果我想连接到 redshift,我正在关注 their example 如何提供你自己的 egg 文件,但是在创建 egg 文件和 运行 脚本后我得到了这个错误
Couldn't find index page for 'redshift-module' (maybe misspelled?)
任何人都可以帮助提供我如何完成提供我自己的图书馆吗?在红移或 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')
提到答案here
在坚果 shell 中,AWS Glue uses Python 3.6 而鸡蛋 'redshift_module-0.1-py3.7.egg' 是使用 python 3.7
构建的您可能还需要查看 documentation,它有一些有用的打包选项,例如 install_requires=['package']
我在 glue 作业中执行基本测试时遇到了同样的问题,在进一步调查场景时我注意到 Glue Python shell 3 仅使用 Python 3.6。注意:使用不同版本的 python 创建的 egg 文件将不会相互支持我在本期中观察到的情况。
要省略这一点,您需要制作一个与任何版本兼容的 wheel 文件。
运行 在您的 setup.py 文件存在的目录中执行以下命令:
$ python3 setup.py bdist_wheel
上传wheel文件到S3 bucket
转到 AWS glue 作业控制台并创建新作业,提供所有必需的参数并将类型更改为“Python Shell”并提供您的 s3 路径(其中 wheel文件存在)在“Python 库路径”