Reputation: 943
I am trying to connect my redshift database from AWS Lambda function. I am getting below error when I try to achieve the connection.
Unable to import module 'lambda_function': No module named 'sqlalchemy'
Below is the import code that I am using in my lambda. I have tried all possible import function. Still noting works. Results in the same error.
from __future__ import print_function
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker
from flask_sqlalchemy import SQLAlchemy
from flask.ext.sqlalchemy import SQLAlchemy as sa
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String
from sqlalchemy.orm import sessionmaker
Upvotes: 1
Views: 3504
Reputation: 51
Put this lib in a Layer and import in your code, maybe this solve your problem. Like Vijayanath Viswanathan saw, build a layer with .zip file.
Upvotes: 0
Reputation: 8561
As 'sqlalchemy' is not a part of AWS SDK you should include it in your deployment package. If you are deploying it as a .zip file then make sure you have included it in the zip
Upvotes: 4