query.py

Home   »   query.py

query = """select name,address,city where pincode = '{}' and date = '{}'""".format(pincode, date)
logging.info("executing query %s", query)
cursor.execute(query)
results = cursor.fetchall()
response = []
for item in results:
    response.append(
        {
            "name": item[0],
            "address": item[1],
            "city": item[2]
        }
    )
logging.info("response %",response)

Leave a Reply

Your email address will not be published.