def query_by_type_owned(type, needcrawl): result_account = session.query(Account).filter( Account.status == 1, Account.type == type, Account.needcrawl == needcrawl).all() # session.refresh(result_account) # session.expunge(result_account) session.expunge_all() session.close() return result_account
def query_by_link_type(accountid, link, type): result_art = session.query(Art).filter(Art.accountid == accountid, Art.link == link, Art.type == type).first() # session.refresh(result_art) # session.expunge(result_art) session.expunge_all() session.close() return result_art
def query_last_by_artid(artid): result_group = session.query(Topic).filter(Topic.artid == artid).order_by(Topic.createdate.desc()) \ .first() session.expunge_all() session.close() return result_group
def query_all_by_type(accountid, type): result_art_list = session.query(Art).filter(Art.accountid == accountid, Art.type == type).all() session.expunge_all() session.close() return result_art_list
def query_last_by_type(accountid, type): result_art = session.query(Art).filter(Art.accountid == accountid, Art.type == type).order_by(Art.createdate.desc())\ .first() session.expunge_all() session.close() return result_art