database.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:kudubot 作者: namboy94 项目源码 文件源码
def thread_exists(thread: Dict[str, str or int], db: sqlite3.Connection) \
        -> bool:
    """
    Checks if a reddit discussion thread with the given thread parameters
    already exists

    :param thread: The thread to check for
    :param db: The database to check
    :return: True if the thread exists, false otherwise
    """
    result = db.execute(
        "SELECT * FROM anime_reminder_threads "
        "WHERE show_name=? AND episode=? AND thread=?",
        (thread["show_name"], thread["episode"], thread["url"])
    )
    return len(result.fetchall()) > 0


# noinspection SqlNoDataSourceInspection,SqlDialectInspection,SqlResolve
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号