def handler(event, context):
  global data
  
  if(data is None or 'IS_LOCAL' in event):
    data = db.query(f'''SELECT * FROM `tipos_de_exame`;''')

  return {
    'statusCode': 200,
    'headers': { 'Access-Control-Allow-Origin': '*' },
    'body': data.to_json(orient='records')
  }
Example #2
0
def handler(event, context):
    global data

    if (data is None or 'IS_LOCAL' in event):
        data = db.query(query_string)

    return {
        'statusCode': 200,
        'headers': {
            'Access-Control-Allow-Origin': '*'
        },
        'body': data.to_json(orient='records')
    }