Created
February 7, 2017 21:11
-
-
Save svrist/17bcc48d4cf2a86ea1391ae46db46b81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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