英文:
How to install python package in snowflake which is not a part of anaconda
问题
I am working on decrypting files (.pgp) from a location in my ADLS, To do that I need to use private key that's in my azure keyvault, I am using Snowflake Python worksheet, as of now I want python library like pgpy, os, base64, azure_keyvault, azure_identity.
Is there any way I can import these libraries that's not a part of anaconda package.
I've staged these library as .whl files but i need help in importing these libraries in my worksheet.
我正在解密位于我的ADLS位置的文件(.pgp),为此我需要使用位于我的Azure密钥库中的私钥,我正在使用Snowflake Python工作表,目前我想要像pgpy、os、base64、azure_keyvault、azure_identity这样的Python库。
是否有办法可以导入这些不是Anaconda包的库。
我已经将这些库制作成了.well文件,但我需要帮助将它们导入我的工作表。
I've staged the .whl files of the required python package in my snowflake.
but struggling how to import them to my worksheet.
Is there any way to use them,
I've also tried sql stored procedure but its not working also
Can anyone help me in the complete step by step manner how to do that
我已经在我的Snowflake中准备了所需Python包的.well文件。
但我不知道如何将它们导入我的工作表。
有没有办法使用它们,
我还尝试过SQL存储过程,但也不起作用。
有人可以以完整的逐步方式帮助我吗?
Also, I've seen that if I staged .Py file we can simply use Import command. So, if I was able to convert the entire azure identity python package to one .py file I'll be able to import it import it directly.
此外,我注意到如果我将.Py文件进行分段,我们可以简单地使用Import命令。所以,如果我能够将整个Azure Identity Python包转换为一个.py文件,我就能够直接导入它。
Stagged files in snowflake here
python packages here
英文:
I am working on decrypting files (.pgp) from a location in my ADLS, To do that I need to use private key that's in my azure keyvault, I am using Snowflake Python worksheet, as of now I want python library like pgpy,os,base64,azure_keyvault,azure_identity.
Is there any way I can import these libraries that's not a part of anaconda package.
I've staged these library as .whl files but i need help in importing these libraries in my worksheet.
I've staged the .whl files of the required python package in my snowflake.
but struggling how to import them to my worksheet.
Is there any way to use them,
I've also tried sql stored procedure but its not working also
Can anyone help me in the complete step by stepo manner how to do that
Also, I've seen that if I staged .Py file we can simply use Import command. So, if I was able to convert the entire azure identity python package to one .py file I'll be able to import it import it directly.
答案1
得分: 1
你想要类似这样的内容:
import snowflake.snowpark as snowpark
# 将轮子添加到系统路径以启用阶段包导入
import sys
import_dir = sys._xoptions.get("snowflake_import_directory")
sys.path.append(import_dir + "python_ulid-1.1.0-py3-none-any.whl")
from ulid import ULID
def ulid(session: snowpark.Session):
a_ulid = ULID()
return str(a_ulid)
英文:
You want something like this
- Add the package to Stage Packages<br>
- Get the Snowflake import directory
- Append the wheel file to the system path
- Import from the library
import snowflake.snowpark as snowpark
# Add wheel to system path to enable stage package import
import sys
import_dir = sys._xoptions.get("snowflake_import_directory")
sys.path.append(import_dir + "python_ulid-1.1.0-py3-none-any.whl")
from ulid import ULID
def ulid(session: snowpark.Session):
a_ulid = ULID()
return str(a_ulid)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论