将查询结果写入S3

时间:2019-02-13 22:39:21

标签: amazon-s3 aws-lambda amazon-redshift

我能够通过Lambda函数查询Redshift-

def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))

conn_string = "my database connection"
conn = psycopg2.connect(conn_string)

cursor = conn.cursor()
print (cursor.execute("select id from members limit 100"))

conn.commit()

rows = cursor.fetchall()  
for r in rows:
    print(r)

cursor.close()

如何将在rows中获得的查询结果写入S3?

0 个答案:

没有答案