Skip to content

Instantly share code, notes, and snippets.

@ganny26
Created May 29, 2021 11:49
Show Gist options
  • Save ganny26/ca425e7648c8ea0e789739ae612a3153 to your computer and use it in GitHub Desktop.
Save ganny26/ca425e7648c8ea0e789739ae612a3153 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment