use pg in Lambda Python for Redshift
I have a Lambda function that is called from a Glue Job. I want to write a row in Redsfhit by using the pg module in Python.
when doing: "import pg" I get the following error:
Response:
{
"errorMessage": "Unable to import module 'lambda_function': No module named 'pg'",
"errorType": "Runtime.ImportModuleError"
}
Could you tell me how to use pg module in Lambda?
the connection specification looks like this:
def get_connection(host):
rs_conn_string = "host=%s port=%s dbname=%s user=%s password=%s" % ("xxx-redshift-c1.something.eu-west-3.redshift.amazonaws.com", 5439, "db", "user", "pass")
rs_conn = pg.connect(dbname=rs_conn_string)
rs_conn.query("set statement_timeout = 1200000")
return rs_conn
then
con1 = get_connection("xxx-redshift-c1.something.eu-west-3.redshift.amazonaws.com")
finally
res2 = con1.query("INSERT INTO...
thanks
from Recent Questions - Stack Overflow https://ift.tt/3kVV4dw
https://ift.tt/eA8V8J
Comments
Post a Comment