def get_currency_rate(self, base, currency, date): session = get_session() return session.query(Currency) \ .filter(and_( Currency.base_currency == base, Currency.currency == currency, Currency.date == date )) \ .first()
def get_notes(self): session = get_session() return session.query(Note).all()
def get_all_notes_with_growth(self): session = get_session() return session.query(Note) \ .filter(or_(Note.growth == True, Note.growth == False)) \ .all()
def get_notes_by_currency(self, curency): session = get_session() return session.query(Note) \ .filter(Note.currency == curency) \ .all()
def get_all_notes_with_currency(self): session = get_session() return session.query(Note) \ .filter(Note.currency != '') \ .all()
def get_notes_by_language_with_session(self, lang): session = get_session() return session, session.query(Note)\ .filter(Note.feed.like("{}_%".format(lang)))\ .all()
def get_note_by_id(self, id): session = get_session() return session.query(Note) \ .get(int(id))