def update(self, department): session.query(Departments).filter( Departments.dept_no == department['dept_no']).update( {Departments.dept_name: department['dept_name']}, synchronize_session=False) session.commit() return department
def create(self, employee): emp = Employees(first_name=employee['first_name'], last_name=employee['last_name'], dept_no=employee['dept_no'], birth_date=employee['birth_date'], hire_date=employee['hire_date']) session.add(emp) session.commit()
def update(self, employee): session.query(Employees).filter( Employees.emp_no == employee['emp_no']).update( { Employees.first_name: employee['first_name'], Employees.last_name: employee['last_name'], Employees.dept_no: employee['dept_no'], Employees.birth_date: employee['birth_date'], Employees.hire_date: employee['hire_date'] }, synchronize_session=False) session.commit() return employee
def create(self, department): dept = Departments(dept_no=department['dept_no'], dept_name=department['dept_name']) session.add(dept) session.commit()
def delete(self, emp_no): session.query(Departments).filter( Departments.dept_no == emp_no).delete() session.commit()
def delete(self, emp_no): session.query(Employees).filter(Employees.emp_no == emp_no).delete() session.commit()