Last active
May 25, 2019 03:29
-
-
Save elseagle/aa6d715f68841e1f91046c960e443dc8 to your computer and use it in GitHub Desktop.
This file contains 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
def find_by_name(name): | |
connection = sqlite3.connect('data.db') | |
cursor = connection.cursor() | |
query = "SELECT * FROM items WHERE name=?" | |
result = cursor.execute(query, (name,)) | |
row = result.fetchone() | |
connection.close() | |
if row: | |
return jsonify({'item': {'name': row[0], 'price': row[1]}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment