job = db.session.query(Job).filter(Job.username == username).limit(10).offset(5).all()
//表示从第五个数据开始查,一共查找十条,可以和前端的datatables的start,limit相配合,其中all()必须加
job = db.session.query(Job).filter(and_(Job.username == username),
Job.create_time.between(start_time, end_time)).all()
//and_相当于sql中where条件查询的and
//时间查找中create_time和end_time均是字符串
job = db.session.query(Job).filter(and_(Job.username == username), and_(Job.job_type == job_type),
Job.job_params.like('%'+file_path_str+'%'))
.order_by(Job.create_time.desc()).all()
//模糊匹配like, 排序order_by()
#1.检索单条记录
#def get_job_config_one(condition, field='*', order):
#2.分页去查找记录列表
#def get_job_config_list(condition, field='a.id,b.name', order, start, limit):
#3.更新记录
#UPDATE job_config set (xxx=xxx,yyy=xxxx) WHERE id=1;
#def update(data, condition)
#4.删除记录
#def delete(condition)
#5.新增记录
#def add(data)
#6.获取total count
#def count(condition)
#7.source sql
#def sql(sql):
#def get_job_config_one(condition, field='*', order):
#2.分页去查找记录列表
#def get_job_config_list(condition, field='a.id,b.name', order, start, limit):
#3.更新记录
#UPDATE job_config set (xxx=xxx,yyy=xxxx) WHERE id=1;
#def update(data, condition)
#4.删除记录
#def delete(condition)
#5.新增记录
#def add(data)
#6.获取total count
#def count(condition)
#7.source sql
#def sql(sql):