I’m attempting to publish an Azure Function using Python 3.9.12 and include the snowflake-snowpark-python library. However, as soon as I import the library and deploy the Azure Function, it no longer appears in the Function App portal. (The function shows up as soon as I publish the code without importing the snowflake-snowpark-python library).
Here are the import lines
from snowflake.snowpark.session import Session
from snowflake.snowpark.functions import when_matched, when_not_matched,col
Here are the library versions I am using:
aiohappyeyeballs==2.4.4
aiohttp==3.11.10
aiosignal==1.3.1
asn1crypto==1.5.1
async-timeout==5.0.1
attrs==24.2.0
azure-functions==1.21.3
azure-functions-durable==1.2.10
beautifulsoup4==4.12.3
boto3==1.35.77
botocore==1.35.77
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.4.0
cloudpickle==2.0.0
cryptography==44.0.0
filelock==3.16.1
frozenlist==1.5.0
furl==2.1.3
greenlet==3.1.1
idna==3.10
jmespath==1.0.1
lxml==5.3.0
multidict==6.1.0
numpy==1.25.2
orderedmultidict==1.0.1
packaging==24.2
pandas==2.0.3
platformdirs==4.3.6
propcache==0.2.1
protobuf==5.29.1
pyarrow==18.1.0
pycparser==2.22
PyJWT==2.10.1
pyodbc==4.0.39
pyOpenSSL==24.3.0
python-dateutil==2.9.0.post0
pytz==2024.2
PyYAML==6.0.2
redshift-connector==2.1.4
requests==2.32.3
s3transfer==0.10.4
scramp==1.4.5
six==1.17.0
snowflake-connector-python==3.12.3
snowflake-snowpark-python==1.5.0
snowflake-sqlalchemy==1.5.1
sortedcontainers==2.4.0
soupsieve==2.6
SQLAlchemy==1.4.7
tomlkit==0.13.2
typing_extensions==4.12.2
tzdata==2024.2
tzlocal==5.2
urllib3==1.26.20
yarl==1.18.3
I have also tested multiple versions of the snowflake-snowpark-python library, but all of them result in the same issue. I am using 1.5.0 because snowflake-snowpark-python’s official documentation recommends that version.
Is there a version I can use which would allow me to publish the Azure function as expected?
P.S. – There are no warnings or errors during the publishing process. Is there a way to debug why the function isn’t appearing in the portal, even though the deployment shows no errors?
My function code:
# Register this blueprint by adding the following line of code
# to your entry point file.
# app.register_functions(blueprint)
#
# Please refer to https://aka.ms/azure-functions-python-blueprints
import azure.functions as func
import logging
from snowflake.snowpark.session import Session
from sqlalchemy.engine import URL
import os
import pandas as pd
import redshift_connector as connector
import json
from snowflake.snowpark.session import Session
from snowflake.snowpark.functions import when_matched, when_not_matched,col
blueprint = func.Blueprint()
@blueprint.route(route="http_trigger", auth_level=func.AuthLevel.FUNCTION)
def http_trigger(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name = req.params.get('name')
if not name:
try:
req_body = req.get_json()
except ValueError:
pass
else:
name = req_body.get('name')
if name:
return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
SOLUTION:
The issue was due to a library called cryptography
, which is a dependency of snowflake.snowpark
.
To fix it I reverted the library version to 43.0.3
.
You can follow the issue here.
2
Answers
The issue was due to a library called
cryptography
, which is a dependency ofsnowflake.snowpark
. To fix it I reverted the library version to43.0.3
. You can follow the issue here.Install the package snowflake-snowpark-python version
1.25.0
and cloudpickle version2.2.1
.I have updated the
requirements.txt
as below:Code Snippet:
Deployed the function to Azure:
Portal:
Able to see the function trigger in Azure function App in portal.