Exemple #1
0
def all_words():
    return [i for i in db_session.query(Word).all()]
Exemple #2
0
def delete_word(word):
    db_session.query(Word).filter_by(_word=word).delete()
    db_session.commit()
Exemple #3
0
def save_word_if_not_exists(word):
    result = db_session.query(Word) \
        .filter(Word._word == word.word).limit(1)
    for model in result:
        return model
    return save_model(word)