python - How can I check to see if some data exists and return a boolean value using SQLAlchemy -


i building flask web-app using sqlalchemy. how can check see if data exists , if exists return true , vice-versa?

you :

exists = db.session.query(your_id).filter_by(your_filter).scalar() not none


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -