Skip to content

Instantly share code, notes, and snippets.

@svrist
Created February 7, 2017 21:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svrist/17bcc48d4cf2a86ea1391ae46db46b81 to your computer and use it in GitHub Desktop.
Save svrist/17bcc48d4cf2a86ea1391ae46db46b81 to your computer and use it in GitHub Desktop.
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