Check if a Row Exists
Check if a row exists in a database table.
db.exists()
db.exists()
Used for checking if a row exists in a table.
Usage
db.exists(...)
Parameters:
A query object of a database row, returned by the different selection methods.
Example
...
my_row = MyModel.db.get_by(email='[email protected]').first()
if db.exists(my_row)
respond(my_row.s())
status('Not found.', 404)
You have to use first()
since db.get_by()
returns a list* of rows.
* = Not a "normal" list, a query object.
Last updated