1

I have followed the standard method for creating a Lambda Layer in Snowflake.

[in a AWS EC2 instance] rm -rf snowflake mkdir -p snowflake/python/lib/python3.7/site-packages pip3 install --no-cache-dir --ignore-installed --upgrade snowflake-connector-python -t snowflake/python/lib/python3.7/site-packages cd snowflake; rm -f snowflake.zip; zip -r snowflake.zip .

I can create the Lambda Layer and then add it to my Lambda function. As well as validate that the library is attached, but when I call the Lambda function, it is failing on

import snowflake.connector

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'snowflake'

Are there any snowflake Lambda libraries or detailed guides on what may be going wrong here. I build lambda layers all the time in this manner and usually the above process works.

1

1 Answer 1

0

The issue turned out to be a requirement on 3.7. I added the following to my library creation and it worked fine:

I changed the default python version in my Lambda function to be 3.7 to match the python instance I used to compile the library, then I added the following into my code:

ssh -i ${PEM_FILE} ${EC2_HOST} "cp -r snowflake/python/lib/python3.7/site-packages/* dblayer/python/lib/python3.7/site-packages"
Sign up to request clarification or add additional context in comments.

2 Comments

I tried with Python 3.7 as well but still its not working for me any other work arounds?
I'm having a similar issue here. No luck so far.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.