For how to use the pip module, I referred to the following article. Thank you very much.
[Python] Using an external module with AWS Lambda https://qiita.com/SHASE03/items/16fd31d3698f207b42c9
You need to bring the Pip module to Lambda, so install the DQL module locally.
In the project folder,
$pip install dql -t ./
The file name is lambda_function.py
import dql
def lambda_handler(event, context):
engine = dql.Engine()
engine.connect(region="us-west-2")
results = engine.execute("DELETE FROM tablename WHERE tm >= 1420071600 AND tm <= 1420705200;")
print(results)
return "hi world"
Modify region
, tablename
, query, etc. to any settings.
zip -r dpl.zip ./*
Upload the completed ZIP to Lambda and you're done.
Recommended Posts