1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00
AdvLabDB/advlabdb/model_independent_funs.py

18 lines
363 B
Python
Raw Normal View History

2022-05-16 20:20:36 +00:00
# Functions not dependent on advlabdb.models
from sqlalchemy import func, select
from . import db
def reportBadAttempt(message):
print("BAD ATTEMPT:", message) # TODO: Log
def get_count(table):
return db.session.scalar(select(func.count()).select_from(table))
def get_first(table):
return db.session.execute(table.limit(1)).scalars().first()