def __init__(self, link, typ, bill, date): self.typ = typ self.link = link self.bill_id = bill.id self.date = date self.download_text() db_session.add(self) self.add_keywords() db_session.commit()
def create(model: M, refresh=False): """ Inserts a new model into the database. All the actual SQL is handled under the hood by SQLAlchemy. However, it's important to note that many tables may be modified by this operation: for example, in the case of a model which contains relationships to other models. Any exceptions thrown by database system are propagated back through this function. :param model: The model to insert :param refresh: If true, immediately refresh ``model`` populating it with data from the database; this involves an additional query so only use it if necessary """ db_session.add(model) db_session.commit() if refresh: db_session.refresh(model)
def __init__(self, num): self.num = num self.add_params() db_session.add(self) db_session.commit()
def __init__(self, chat_id): self.chat_id = chat_id db_session.add(self) db_session.commit()
def __init__(self, descr, date, bill): self.descr = descr self.date = date self.bill_id = bill.id db_session.add(self) db_session.commit()
def __init__(self, user, word): self.word = word.lower().strip() self.users.append(user) db_session.add(self) db_session.commit() self.find_new_keyword()