diff --git a/advlabdb/dependent_funs.py b/advlabdb/dependent_funs.py index 430446f..a41a6dd 100644 --- a/advlabdb/dependent_funs.py +++ b/advlabdb/dependent_funs.py @@ -1,7 +1,7 @@ from flask import flash, url_for from flask_admin.menu import MenuLink from flask_security import current_user -from sqlalchemy import select +from sqlalchemy import func, select from . import app, db from .models import Semester @@ -83,3 +83,7 @@ def initActiveSemesterMenuLinks(space): def reportBadAttempt(message): print("BAD ATTEMPT:", message) # TODO: Log + + +def get_count(table): + return db.session.scalar(select(func.count()).select_from(table))