def add_concept(self, concept): q = Query\ .into(self.table_reference)\ .columns( self.table_reference.relation, self.table_reference.first, self.table_reference.second, self.table_reference.userid, self.table_reference.score, self.table_reference.valid)\ .insert( concept.relation, concept.first, concept.second, concept.user_id, concept.score, concept.valid) query = q.get_sql() query = query.replace("\"", "") print(query) sql_response = SQLExecuter.execute_write_query(query) return sql_response
def delete_concept(self, first, relation, second): q = Query\ .from_(self.table_reference)\ .delete()\ .where( (self.table_reference.first == first) & (self.table_reference.relation == relation) & ( self.table_reference.second == second) ) query = q.get_sql() query = query.replace("\"", "") print(query) sql_response = SQLExecuter.execute_write_query(query) return sql_response
def update_valid(self, first, relation, second, valid): q = Query\ .update(self.table_reference)\ .set(self.table_reference.valid, valid)\ .where( (self.table_reference.first == first) & (self.table_reference.relation == relation) & ( self.table_reference.second == second) ) query = q.get_sql() query = query.replace("\"", "") print(query) sql_response = SQLExecuter.execute_write_query(query) return sql_response
def add_user(self, user): q = Query\ .into(self.table_reference)\ .columns( self.table_reference.name, self.table_reference.code)\ .insert( user.name, user.code ) query = q.get_sql() query = query.replace("\"", "") print(query) sql_response = SQLExecuter.execute_write_query(query) if sql_response is not None: user.id = sql_response return user