Skip to content

Instantly share code, notes, and snippets.

Created Feb 7, 2017
What would you like to do?
from __future__ import division, print_function, unicode_literals
import _pathmangle # noqa # pylint: disable=W0611
import lambdahelper # noqa # pylint: disable=W0611
lambdahelper.setup_logging() # noqa
import json
import psycopg2
import logging
log = logging.getLogger('handler')
with open(os.path.join(os.path.dirname(__file__), 'rds.env.json')) as f:
connection_info = json.load(f)
conn = psycopg2.connect(connection_info['uri'])
cur = conn.cursor()
def hellow_world(event, context):
cur.execute("select 'Hello, World'");
s, = cur.fetchone()
log.debug('Got result %r', s)
return {
'statusCode': 200
'body': json.dumps({'result': s})
'headers': {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment