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

php - Autoloader issue not returning Class -

java - How to put two numbers separated by a space into two different arrays -

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