'Parsing the return of SQLite Query in Python
I have an SQLite database in a Flask (Python) web application and this is my code to see if an email has already registered (in my application.py file). It returns a boolean (1 or 0) if it exists or not, respectively.
db = SQL("sqlite:///test.db")
exists = db.execute("SELECT EXISTS(SELECT 1 FROM people WHERE email in (?))", ([email protected]))
Where print(exists) returns:
[{"EXISTS(SELECT 1 FROM people WHERE email in ('[email protected]'))": 1}]
In short, I get the required result (tested with unregistered and registered emails), but I don't know how to access this value of 1 or 0.
Would appreciate any ideas a lot.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
