add get_themes_orderedby_cname() to database.py

This commit is contained in:
Trent Palmer 2021-08-23 20:13:14 -07:00
parent 466b1e6e3a
commit ec3f66eebf
1 changed files with 7 additions and 2 deletions

View File

@ -2,19 +2,18 @@ from rank_hugo_themes import (
engine, Hugothemes,
Hugothemes_from_gitlab, sessionmaker
)
from sqlalchemy import asc, func
def get_theme_count():
session = sessionmaker(bind=engine)()
theme_count = session.query(Hugothemes).count()
print(theme_count)
return theme_count
def get_theme_count_from_gitlab():
session = sessionmaker(bind=engine)()
theme_count_from_gitlab = session.query(Hugothemes_from_gitlab).count()
print(theme_count_from_gitlab)
return theme_count_from_gitlab
@ -35,6 +34,12 @@ def get_newest_update_time_from_gitlab():
return newest_commit_time
def get_themes_orderedby_cname():
session = sessionmaker(bind=engine)()
return session.query(
Hugothemes).order_by(asc(func.lower(Hugothemes.cname))).all()
def get_themes():
session = sessionmaker(bind=engine)()
return session.query(Hugothemes).all()