def test_filter_notin(self):
     emps = session.query(Employee).filter(
         ~Employee.EDUCATION.in_(['Bachelor', 'Master'])).all()
     print(to_formatted_table(emps))
 def test_filter_isnotnull(self):
     emps = session.query(Employee).filter(
         Employee.MARITAL_STAT != None).all()
     print(to_formatted_table(emps))
 def test_filter_like(self):
     emps = session.query(Employee).filter(Employee.EMP_ID.like('%9')).all()
     print(to_formatted_table(emps))
 def test_filter_ne(self):
     emps = session.query(Employee).filter(Employee.EMP_ID != '1001').all()
     print(to_formatted_table(emps))
 def test_query_all(self):
     # 对象作参数,返回值类型为 list[Employee_Object]
     employees = session.query(Employee).all()
     print(to_formatted_table(employees))
 def test_filter_or(self):
     emps = session.query(Employee).filter(
         or_(Employee.MARITAL_STAT == 'Single',
             Employee.NR_OF_CHILDREN == 0)).all()
     print(to_formatted_table(emps))
 def test_filter_and2(self):
     emps = session.query(Employee).filter(
         and_(Employee.GENDER == 'Female',
              Employee.EDUCATION == 'Bachelor')).all()
     print(to_formatted_table(emps))